It's soooo easy, I think.
#include <stdio.h>
int atoi(unsigned char *str)
{
int num = 0;
while (*str >= '0' && *str <= '9') num = num * 10 + *str++ - '0';
return num;
}
int main(void)
{
printf("%d\n", atoi("12345"));
return 0;
}
So easy, right?
-
Poechant
-