When working in C, we can use the ctype.h standard library set of functions to check the value of a char type variable.
We have access to several useful checks:
- isalnum() checks if a character is alphanumeric
- isalpha() checks if a character is alphabetic
- iscntrl() checks if a character is a control character
- isdigit() checks if a character is a digit
- isgraph() checks if a character is a printable ASCII character (but not a space)
- islower() checks if a character is lowercase
- isprint() checks if a character is a printable ASCII character
- ispunct() checks if a character is a punctuation character (a printable char, not a space, not alphanumeric)
- isspace() checks if a character is a whitespace character (see more later)
- isupper() checks if a character is uppercase
- isxdigit() checks if a character is an hexadecimal digit (0-F)
#c #c# #c++ #programming-c