itoa(3C) DG/UX 5.4 Rel. 2.01 itoa(3C)
NAME
itoa - convert an integer to an ASCII character string
SYNOPSIS
char *itoa(int num, char *string);
where:
num Value of type int
string A byte pointer to a character array
DESCRIPTION
The itoa function converts an integer to an ASCII string. If num is
negative, the string will contain a minus sign, one to 10 digits, and
a null.
The maximum number of characters itoa returns is 13.
EXAMPLE
#include <stdio.h>
#define STRINGMIN 13
int i = 1, num;
char string[STRINGMIN], *itoa(int, char *);
main(argc, argv)
int argc;
char *argv[];
{
while (i < argc) {
num = atoi(argv[i]);
num *= i;
itoa(num, string);
printf("%s\n", string);
i++;
}
return 0;
}
A call to the program test with the numbers 1, 2, 3, and 4 generates
the output
1
4
9
16
RETURN VALUE
Address The address of the string returned
SEE ALSO
atoi(3C), sprintf(3S).
Licensed material--property of copyright holder(s) 1