C library <ctype.h> header functions
Muhammad Hassaan Shah
2 min read
Table of contents
The <ctype.h>
header file in the C programming language provides several functions to test and manipulate characters. Here are some of the most commonly used functions that are present in C Library ctype_h file:
Exploring ctype library functions
Functions | Description |
isalpha() | Checks if the passed character is alphabetic. Returns a non-zero value if c is an alphabet, else returns 0. |
isdigit() | Checks if the passed character is a digit. Returns a non-zero value if c is a digit, else returns 0. |
isalnum() | Checks if the passed character is alphanumeric. Returns non-zero value if c is an alphanumeric character, else returns 0. |
isspace() | Checks if the passed character is white-space. Returns a non-zero value if c is a white-space character, else returns 0. |
islower() | Checks if the passed character is lowercase. Returns a non-zero value if c is a lowercase character, else returns 0. |
isupper() | Checks if the passed character is uppercase. Returns non-zero value if c is an uppercase character, else returns 0. |
isxdigit() | Checks if the passed character is a hexadecimal digit. Returns non-zero value if c is a hexadecimal digit, else returns 0. |
iscntrl() | Checks if the passed character is a control character. Returns a non-zero value if c is a control character, else returns 0. |
isprint() | Checks if the passed character is printable. Returns a non-zero value if c is a printable character, else returns 0. |
ispunct() | Checks if the passed character is punctuation. Returns non-zero value if c is a punctuation character, else returns 0. |
isgraph() | Checks if the passed character has a graphical representation using locale. Returns a non-zero value if c has a graphical representation, else returns 0. |
toupper() | Converts lowercase letters to uppercase. Returns the uppercase equivalent to letters, if such value exists, else letters remain unchanged. The character’s value must be representable as an unsigned char or the value of EOF. |
tolower() | Converts uppercase letters to lowercase. Returns the lowercase equivalent to the letters, if such value exists, else letters remain unchanged. The character’s value must be representable as an unsigned char or the value of EOF. |
0
Subscribe to my newsletter
Read articles from Muhammad Hassaan Shah directly inside your inbox. Subscribe to the newsletter, and don't miss out.
c programming#isdigitC #isalnum #isalpha #iscntrl #isgraph #islower #isprint #ispunct#isspace #isupper #isxdigit #tolower #toupper
Written by
Muhammad Hassaan Shah
Muhammad Hassaan Shah
Passionate about new technological trends and like to share practical tips and tutorials about C, C++, Python, MATLAB, STM32, Arduino, ESP32, and more …