Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

C Standard Library – <ctype.h>


May 11, 2021 C


Table of contents


C Standard Library - slt;ctype.h>

Brief introduction

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

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

If parameter c meets the conditions described, these functions return non-zero (true). If parameter c does not meet the conditions described, these functions return zero.

The library function

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

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

The standard library also contains two conversion functions that 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.

The character class

Serial number Character class & description
1 number
Complete digital collection {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
2 Hexadecimal number
Collection {0 1 2 3 4 5 6 7 8 9 A B C D e f A B C D e f}
3 Lower case letters
Collection {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 letter
Collection {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 letter
Collection of lowercase letters and uppercase letters
6 Alphanumeric characters
Collection of numbers, lowercase letters and uppercase letters
7 Point symbol character
Collection! "# $% & '() * +, -. /:; <=>? @ [\] ^ _` {|} ~
8 Graphic character
Alphanumeric characters and tag symbol characters collection
9 Space character
Table characters, wraps, vertical gauges, change pages, carriage returns, spaces.
10 Printable characters
Alphanumeric characters, tag symbol characters and gathered characters.
11 Control character
In ASCII encoding, the octatifacts of these characters are from 000 to 037, and 177 (DEL).
12 Gum character
Includes spacers and tab.
13 Alphabetic characters
Collection of lowercase letters and uppercase letters.