2023-08-20 23:05:08 +00:00
|
|
|
|
|
|
|
int
|
|
|
|
atoi(const char *nptr)
|
|
|
|
{
|
|
|
|
int i = 0;
|
|
|
|
int val = 0;
|
|
|
|
|
|
|
|
while (nptr[i] != '\0') {
|
|
|
|
if (nptr[i] >= '0' && nptr[i] <= '9') {
|
|
|
|
val = val * 10 + (int)(nptr[i] - '0');
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
2023-08-21 21:00:18 +00:00
|
|
|
i++;
|
2023-08-20 23:05:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|