C programming character handling library functions

In this article, you will learn about different C programming character handling library functions that are used for character processing.

c programming character handling library functions

As we know that characters are the fundamental building blocks of every program.

A character constant is represented as a character in a single quote.  The value of character constant is an integer.

For example, a is represented as 'a' which is actually the integer value equal to 97 in ASCII.

Similarly, '\n' represents the integer value of newline equal to 10 in ASCII.

C provides standard character handling library <ctype.h>.

We should include character handling library i.e. <ctype.h> for using different character handling function.

This header include various useful functions for performing tests and manipulations of character data in C programming.

The function in <ctype.h> recieves an unsigned char represented as int or EOF as argument.

In C programming, character is a one byte integer.

[adsense1]

C Character handling library <ctype.h> functions


C programming character library functions with description

int islower( int ch );
It returns a true if ch is a lowercase letter and 0 otherwise.
int isupper( int ch );
It returns a true value if ch is a uppercase and 0 therwise.
int tolower( int ch );
This function converts uppercase letter into lowercase letter.
int toupper( int ch );
This function converts lowercase letter into uppercase letter.
int isblank( int ch );
This function checks whether ch is a blank character or not.
int isdigit( int ch );
This function checks whether ch is a digit or not.
int isalpha int ch );
This function checks whether ch is a letter or not.
int isalnum( int ch );
This function returns a 1 if ch is a digit or a letter and 0 otherwise.
int isxdigit( int ch );
This function checks if ch is a hexadecimal digit or not.
int isspace( int ch );
This function checks if ch is a whitespace character or not.
int isgraph( int ch );
This function checks if ch is a printing character other than a space or not.
int iscntrl( int ch );
This function checks if ch is a control character or not.
int isprint( int ch );
This function checks if ch is a printing character including a space or not.
int ispunct( int ch );
This function checks if ch is a printing character other than a digit, a space, a letter or not.