How this function works? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

How this function works?

int is_digit(char c) { return ('0' <= c) && (c <= '9'); }

15th Dec 2021, 6:57 PM
M Samiul Hasnat
M Samiul Hasnat - avatar
3 Respuestas
+ 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.
15th Dec 2021, 7:04 PM
Alex
Alex - avatar
0
?
15th Dec 2021, 6:58 PM
M Samiul Hasnat
M Samiul Hasnat - avatar
0
Martin Taylor , I'm a beginner and learning C language. That's why I'm trying to build this function. Thank you.
16th Dec 2021, 2:21 AM
M Samiul Hasnat
M Samiul Hasnat - avatar