home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / gutil / itoa.c < prev    next >
Encoding:
C/C++ Source or Header  |  1985-01-23  |  352 b   |  34 lines

  1. # include    <sccs.h>
  2.  
  3. SCCSID(@(#)itoa.c    8.1    12/31/84)
  4.  
  5. /*
  6. **  ITOA -- integer to ascii conversion
  7. */
  8.  
  9. itoa(i, a)
  10. register int    i;
  11. register char    *a;
  12. {
  13.     register char    *j;
  14.     char        b[6];
  15.  
  16.     if (i < 0)
  17.     {
  18.         *a++ = '-';
  19.         i = -i;
  20.     }
  21.     j = &b[5];
  22.     *j-- = 0;
  23.     do
  24.     {
  25.         *j-- = i % 10 + '0';
  26.         i /= 10;
  27.     } while (i);
  28.     do
  29.     {
  30.         *a++ = *++j;
  31.     } while (*j);
  32.     return (0);
  33. }
  34.