C Program to Check whether the entered character is capital, small letter, digit or special character2 min read

In this tutorial, we will write a program to check whether the entered character is capital, small letter, digit or any special character using C programming.

Here, we will write two different C program,

  1. user library function
  2. ASCII value of the character

1. Using library function

The following C program Check whether the entered character is capital, small letter, digit or special character by using the user library function provided by the ctype.h header file.

Following are some of the library functions in C:

  • isupper(): It returns true if the character is in uppercase.
  • islower(): It returns true if the character is in lowercase.
  • isdigit(): It returns true if entered character is a digit.
  • isalpha(): This function checks whether the passed character is alphabetic.
  • isspace(): This function checks whether the passed character is white-space.
    etc.

C Program:

Output:

//First Execution
Enter a Character: A
A is an Upper case character.

//Second Execution
Enter a Character: b
b is a Lower case character.

//Third Execution
Enter a Character: 7
7 is a Digit character.

//Fourth Execution
Enter a Character: @
@ is a Special character.


2. ASCII value of the character

The following C Program To Check For Alphabet, Number, and Special Symbol using the ASCII value.

The following table shows the range of ASCII values for various characters.

CharactersASCII Values
A – Z65 – 90
a – z97 – 122
0 – 948 – 57
special symbols0 – 47, 58 – 64, 91 – 96, 123 – 127

C Program:

Output:

//Run 1
Enter a Character: 7
7 is a Digit Character.

//Run 2
Enter a Character: A
A is an Upper case Character.


MORE

String Pattern Programs in C

In this tutorial, we will write various C pattern programs for String. Before that, you may go through the following topics in C. for loop …
Read More

Java Program to Find pair of Integers in Array whose sum is given Number

In this tutorial, we will write a program to find a pair of elements from an array whose sum equals a given number in java …
Read More

Program to Print Diamond Alphabet Patterns in C

In this tutorial, we will learn to write a C program to print Diamond patterns using alphabets/characters. However, in this tutorial, we will create a …
Read More

Half Diamond Pattern in C using Alphabets

In this tutorial, we will learn and code the half diamond alphabet patterns in C programming language. However, in this tutorial, we will create a …
Read More

Half Pyramid of Alphabets in C

In this tutorial, we will learn and code alphabet patterns in C programming language specifically the Half pyramid of alphabets in C programming. However, in …
Read More

Inverted Half Pyramid Pattern of Alphabets in C

In this tutorial, we will write a C program to print half Pyramid using alphabets/characters. Before that, you may go through the following topic in …
Read More