www.delorie.com/djgpp/doc/libc/libc_517.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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

ANSI/ISO C No
POSIX No

Example

 
char binary_str[33];

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


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004