+ 1
How this function works?
int is_digit(char c) { return ('0' <= c) && (c <= '9'); }
4 Respostas
+ 4
Chars are basically just integers, which under certain circumstances get interpreted like characters.
'0' is 48, '9' is 57. If the input char is between 48 and 57, it's a digit.
0
?
0
Martin Taylor , I'm a beginner and learning C language. That's why I'm trying to build this function. Thank you.