Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>itoa() convert integer to string</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 itoa()                  Convert Integer to String

 #include   <stdlib.h>

 char       *itoa(value,string,radix);
 int        value;                       Number to be converted
 char       *string;                     String result
 int        radix;                       Base of 'value'

    itoa() stores the integer 'value' in 'string' after converting it to
    a null-terminated string.  'radix' must be in the range 2 - 36 and
    specifies the base to be used in converting 'value'.  If 'value' is
    negative and 'radix' is 10, the first character of 'string' is a
    minus sign (-).  Space allocated for 'string' must be large enough to
    hold the returned string. itoa() can return up to 17 bytes.


    Returns:    A pointer to 'string'; no error return.

 Portability:   Applies to MS DOS only.

   -------------------------------- Example ---------------------------------

    The following statements convert an integer to a string and print it
    out.

           #include <stdlib.h>
           #include <stdio.h>              /* for printf */

           int radix = 10;
           char buffer[20];
           char *strptr;

           main()
           {
               strptr = itoa(100,buffer,radix);
               printf("The amount converted: %s\n",strptr);
           }



See Also: ltoa() ultoa()

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