2 ms·
More to the point, char should be unsigned so that this code is safe: #include <ctype.h> if (isdigit(str[i])) { ... } The ctype functions require an in
by kazinator 12y ago
More to the point, char should be unsigned so that this code is safe:
#include <ctype.h>
if (isdigit(str[i])) { ... }
The ctype functions require an int-valued argument which is the value of an unsigned char: it must be a positive value, or the negative value EOF.
This is an unfriendly pitfall in the language.