Go to the source code of this file.
|
int | atoi (const char *nptr) |
|
◆ atoi()
int atoi |
( |
const char * |
nptr | ) |
|
Definition at line 3 of file stdlib.c.
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}