Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>itoa</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
itoa

Usage

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

Description

   itoa converts value to a null terminated string using a radix. The radix
   specifies the base and must be in the range between 2 and 36. If value is
   negative and the radix is 10, the first character of the stored string is
   -'. The result is stored into the string pointed to by str, which must be
   large enough to hold the result.

Example 

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

   int main()
   {
       char buffer[10];
       int value = 67;
       char *ptr;
       ptr = itoa(value,buffer,2);
       printf("The number %d equals binary = \"%s\"\n",value,buffer);
       ptr = itoa(value,buffer,8);
       printf("The number %d equals octal = \"%s\"\n",value,buffer);
       ptr = itoa(value,buffer,16);
       printf("The number %d equals hex = \"%s\"\n",value,buffer);
       return EXIT_SUCCESS;
   }

Return Value

   itoa returns str. There is no error return.

See Also

   ltoa



See Also: ltoa

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson