C Standard Library - <ctype.h>


Introduction

The ctype.h header file of the C standard library provides some functions that can be used to test and map characters.

These functions accept int as argument, its value must be EOF or represented as an unsigned character.

These functions return non-zero (true) if parameter c satisfies the described conditions. These functions return zero if argument c does not satisfy the described condition.

Library functions

The functions defined in the header file ctype.h are listed below:

Serial number Function & Description
1int isalnum(int c)
This function checks whether the passed characters are letters and numbers.
2int isalpha(int c)
This function checks whether the passed character is a letter.
3int iscntrl(int c)
This function checks whether the passed character is a control character.
4int isdigit(int c)
This function checks whether the passed character is a decimal number.
5int isgraph(int c)
This function checks whether the passed characters have a graphical representation.
6int islower(int c)
This function checks whether the passed character is a lowercase letter.
7int isprint(int c)
This function checks whether the passed characters are printable.
8int ispunct(int c)
This function checks whether the passed character is a punctuation character.
9int isspace(int c)
This function checks whether the passed character is a blank character.
10int isupper(int c)
This function checks whether the passed character is an uppercase letter.
11int isxdigit(int c)
This function checks whether the passed character is a hexadecimal number.

The standard library also contains two conversion functions, which accept and return an "int"

Serial numberFunction & Description
1int tolower(int c)
This function converts uppercase letters to lowercase letters.
2int toupper(int c)
This function converts lowercase letters to uppercase letters.

Character Class

67891011##Control characters##12##. #White space charactersIncludes space characters and tab characters Alphabetic characters
Serial NumberCharacter Class & Description
1 Numbers
Complete set of numbers {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
2Hexadecimal numbers
Set { 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f }
3Lowercase letters
set{ a b c d e f g h i j k l m n o p q r s t u v w x y z }
4uppercase letters
set{ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z }
5##LettersSet of lowercase letters and uppercase letters
Alphanumeric charactersA collection of numbers, lowercase letters, and uppercase letters
Punctuation characterCollection! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~
Graphic charactersA collection of alphanumeric and punctuation characters
Space charactersA collection of tab characters, line feed characters, vertical tab characters, form feed characters, carriage return characters, and space characters.
Printable CharactersA collection of alphanumeric characters, punctuation characters, and space characters
#. In ASCII encoding, the octal codes for these characters are from 000 to 037, and 177 (DEL)
##13
A collection of lowercase and uppercase letters ##