home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
ENTERPRS
/
CPM
/
UTILS
/
S
/
SMC21LIB.LZH
/
ITOA.C
< prev
next >
Wrap
Text File
|
2000-06-30
|
512b
|
25 lines
#define NOCCARGC
/*
** itoa(n,s) - Convert n to characters in s
*/
itoa(n,s) char *s; int n; {
int sign;
char *ptr;
ptr = s;
if ((sign = n) < 0) /*record sign*/
n = -n; /*make positive*/
do { /* generate digits in reverse order */
*ptr++ = n % 10 + '0'; /*get next digit*/
} while ((n = n / 10) > 0); /*delete it*/
if (sign < 0) *ptr++ = '-';
*ptr = '\0';
reverse(s);
}