home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Guide
/
c-cplusplus-interactive-guide.iso
/
c_ref
/
csource4
/
223_01
/
atoi.c
< prev
next >
Wrap
Text File
|
1979-12-31
|
512b
|
18 lines
#define NOCCARGC /* no argument count passing */
/*
** atoi(s) - convert s to integer.
*/
static int sign, n;
atoi(s) char *s; {
while(isspace(*s)) ++s;
sign = 1;
switch(*s) {
case '-': sign = -1;
case '+': ++s;
}
n = 0;
while(isdigit(*s)) n = 10 * n + *s++ - '0';
return (sign * n);
}