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++ Language Reference - itoa 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.

   Return Value
   itoa returns str. There is no error return. Example

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

   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);
   }


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