itoa

Converts an integer to a string.

Library:LibC
Classification:ANSI
Service:General C Services

Syntax

  #include <stdlib.h> 
   
  char *itoa (
     int     value,   
     char   *buffer,   
     int     radix);
  

Parameters

value

(IN) Specifies the integer value to be converted.

buffer

(OUT) Points to the character array.

radix

(IN) Specifies the base to be used in converting the integer. It must be in the range of 2 - 36.

Return Values

Returns the pointer to the result.

Remarks

The itoa function converts the integer value into the equivalent string in base radix notation, storing the result in the character array pointed to by buffer. A null-terminating character is appended to the result.

The size of buffer must be at least (8 * sizeof (int) + 1) bytes when converting values in base 2.

If the value of radix is 10 and value is negative, the first character stored in buffer is a minus sign.

See Also