CS350 COS
COS
Loading...
Searching...
No Matches
stdlib.c
Go to the documentation of this file.
1
2int
3atoi(const char *nptr)
4{
5 int i = 0;
6 int val = 0;
7
8 while (nptr[i] != '\0') {
9 if (nptr[i] >= '0' && nptr[i] <= '9') {
10 val = val * 10 + (int)(nptr[i] - '0');
11 } else {
12 return 0;
13 }
14 i++;
15 }
16
17 return val;
18}
19
int atoi(const char *nptr)
Definition: stdlib.c:3