Borland C++ reference

itoa

raw OCR

Converts an integer to a string.

Defined in header <stdlib.h>

Syntax

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

Portability

DOSUNIXWindowsANSI CC++ only
■■

Remarks

itoa converts value to a null-terminated string and stores the result in string. With itoa, value is an integer.

radix specifies the base to be used in converting value; it must be between 2 and 36, inclusive. If value is negative and radix is 10, the first character of string is the minus sign (-).

\s^

The space allocated for string must be large enough to hold the returned string, including the terminating null character (\0). itoa can return up to 17 bytes.

Return value

itoa returns a pointer to string.

See also

Example

#include <stdlib.h>
#include <stdio.h>

int main(void)

   int number = 12345;
   char string[25];
   itoa(number, string, 10);
   printf("integer = %d string = %s\n", number,  string);
   return 0;

Differences from modern implementations

Nothing recorded yet.

Modern references

These are search links, not yet checked by hand.