Name
itoa - Converts integer to string.
Syntax
#include <stdlib.h>
char *itoa(value, string, radix)
int value;
char *string;
int radix;
Description
The itoa function converts the digits of the given value to
a null-terminated character string and stores the result (up
to 17 bytes) in string. The radix argument specifies the
base of value; it must be in the range 2 - 136. If radix
equals 10 and value is negative, the first character of the
stored string is the minus sign (-).
Return Value
The itoa function returns a pointer to string. There is no
error return.
See Also
ltoa(DOS), ultoa(DOS)
Example
#include <stdlib.h> #include <stdio.h>
int radix = 8; char buffer[20]; char *p; main()
{ /* p = "171213" */
p = itoa(-3445,buffer,radix);
printf( "buffer= \"%s\"\n", buffer );
} This program displays -3445 as a base-8 string.
(printed 6/18/89)