Go to the first, previous, next, last section, table of contents.


itoa

Syntax

#include <stdlib.h>

char * itoa(int value, char *string, int radix)

Description

This function converts its argument value into a null-terminated character string using radix as the base of the number system. The resulting string with a length of upto 33 bytes (including the optional sign and the terminating NULL is put into the buffer whose address is given by string. For radixes other than 10, value is treated as an unsigned int (i.e., the sign bit is not interpreted as such). The argument radix should specify the base, between 2 and 36, in which the string reprsentation of value is requested.

Return Value

A pointer to string.

Portability

not ANSI, not POSIX

Example

char binary_str[33];

(void)itoa(num, binary_str, 2);


Go to the first, previous, next, last section, table of contents.