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() converts the integer 'value' to a null-terminated string and
    stores it in 'string'.  'radix' specifies the base to be used in
    converting 'value'; it must be in the range 2 - 36.  If 'value' is
    negative and 'radix' is 10, the first character of 'string' is a
    minus sign (-).
 
    Returns:    A pointer to 'string'.  There is no error return.
 
      Notes:    Enough space for 'string' must be allocated to hold the
                returned string. itoa() can return up to 17 bytes.
 
  -------------------------------- 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);
          }

Seealso:



This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster