int my_getchar(char *foo) { if (!*foo) return -1; // Return -1 at end of string else return *foo; // Should never return -1 }
#include <ctype.h> if (isdigit(str[i])) { ... }
This is an unfriendly pitfall in the language.