I've problem in recoding function atoi. Here is the code (just function body):
int atoi2(const char *s) {
int i, sum = 0;
for (i = 0; isdigit('*s') == 1; s++) {
sum = (sum * 10) + *s;
i++;
}
return sum;
}
Whenever i call function within parameter as string (like "12345"), i just get the 0. Seems like it passes the for loop.
Meanwhile, yes i used the header
#include<ctype.h>
for using function int isdigit(int).