|
|
|
|
|
by ronsor
31 days ago
|
|
You don't need to parse the strings in reverse. That's for printing integers, not parsing. Roughly: int stdin_atoi() {
int i = 0;
while (1) {
int c = getchar();
if (c >= '0' && c <= '9') {
i = i * 10 + (c - '0');
} else { break; }
}
return i;
}
|
|