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 |
---|---|
1 | int isalnum(int c) This function checks whether the passed characters are letters and numbers. |
2 | int isalpha(int c) This function checks whether the passed character is a letter. |
3 | int iscntrl(int c) This function checks whether the passed character is a control character. |
4 | int isdigit(int c) This function checks whether the passed character is a decimal number. |
5 | int isgraph(int c) This function checks whether the passed characters have a graphical representation. |
6 | int islower(int c) This function checks whether the passed character is a lowercase letter. |
7 | int isprint(int c) This function checks whether the passed characters are printable. |
8 | int ispunct(int c) This function checks whether the passed character is a punctuation character. |
9 | int isspace(int c) This function checks whether the passed character is a blank character. |
10 | int isupper(int c) This function checks whether the passed character is an uppercase letter. |
11 | int 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 number | Function & Description |
---|---|
1 | int tolower(int c) This function converts uppercase letters to lowercase letters. |
2 | int toupper(int c) This function converts lowercase letters to uppercase letters. |
Character Class
Serial Number | Character Class & Description |
---|---|
1 | Numbers Complete set of numbers {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} |
2 | Hexadecimal numbers Set { 0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f } |
3 | Lowercase 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 } |
4 | uppercase 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 | |
#. | ##Control charactersIn ASCII encoding, the octal codes for these characters are from 000 to 037, and 177 (DEL) | ##12##.
Includes space characters and tab characters | ##13 |
A collection of lowercase and uppercase letters | ## |