itoa(3C) DG/UX 4.31 itoa(3C)
NAME
itoa - convert an integer to an ASCII character string
SYNOPSIS
int num;
char *itoa(int, char *), string;
...
itoa(num, string);
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 include file stdio.h defines this function. It also
defines a macro Litoa, which is replaced by 13, the maximum
number of characters itoa returns.
RETURN VALUE
Address The address of the string returned
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("%s0, 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
Licensed material--property of copyright holder(s) Page 1
itoa(3C) DG/UX 4.31 itoa(3C)
SEE ALSO
atoi(3C), sprintf(3C).
Licensed material--property of copyright holder(s) Page 2