Next: , Previous: getenv, Up: Stdlib


2.19 itoa—integer to string

Synopsis

     #include <stdlib.h>
     char *itoa(int value, char *str, int base);
     char *__itoa(int value, char *str, int base);
     

Description
itoa converts the integer value to a null-terminated string using the specified base, which must be between 2 and 36, inclusive. If base is 10, value is treated as signed and the string will be prefixed with '-' if negative. For all other bases, value is treated as unsigned. str should be an array long enough to contain the converted value, which in the worst case is sizeof(int)*8+1 bytes.


Returns
A pointer to the string, str, or NULL if base is invalid.

Portability
itoa is non-ANSI.

No supporting OS subroutine calls are required.