• C Programming language offers rich set of conversion functions to meet our need. In my last post, we had discussed about some of basic I/O functions.
  • In this post, we will learn some of the frequently used conversion functions available in <ctype.h> header file.

1. isdigit()

Use:

  • It is used to check if argument is digit or other character. It returns true if character is digit else false.

Syntax:

 isdigit (char) ;

Example

isdigit(‘10’)

Output:

true

2. isalpha()

Use:

  • It is used to check if argument character is alphabet (a to z) or other character. It returns true if character is alphabet and false otherwise.

Syntax:

     isalpha (char) ;

Example:

isalpha(‘A’)

Output:

    true

3. isalnum()

Use:

  • It is used to check if argument character is alphabet (a to z) or number (0 to 9) or other character. It returns true if character is alphabet or digit and false otherwise.

Syntax:

   isalpha (char) ;

Example:

   isalpha(‘10) ;

Output:

   true

4. isupper()

Use:

  • It is used to check if character is upper case or not. It returns true if character is upper case and false otherwise.

Syntax:

    isupper (char) ;

Example:

isupper(‘a’) ;

Output:

  false

5. islower()

Use:

  • It is used to check if character is lower case or not. It returns true if character is lower case and false otherwise.

Syntax:

 islower (char) ;

Example:

islower(‘a’) ;

Output:

 true

6. isspace()

Use:

  • It is used to check if character is space or not. It returns true if character is space and false otherwise.

Syntax:

 isspace (char) ;

Example:

isspace(‘a’) ;

Output:

false

7. isspunct()

Use:

  • It is used to check if character punctuation mark or not. It returns true if it is and false otherwise.

Syntax:

ispunct (char) ;

Example:

ispunct(‘!’) ;

Output:

true

8. toupper()
Use:

  • It is used to convert lower case character to upper case.

Syntax:

toupper (char) ;

Example:

toupper(‘a’) ;

Output:

A

9. tolower()

Use:

  • It is used to convert upper case character to lower case.

Syntax:

tolower (char) ;

Example:

tolower(‘A’) ;

Output:

a