C Program to check character is an alphabet, Digit or Special Character.

Spread the love

Check Character:

Write a C Program to Check Character is an Alphabet, Digit or Special Character. The program should accept an character from the user and detect if the given character is Alphabet or Digit or Special Character.

Here are the example input and excepted output of the program.

Example 1



Example 2:



Example 3:



Algorithm – Check character is an alphabet, Digit or Special Character :

Here is the algorithm of the character detection program.

  • The program should take one character as the input from the user. We are going to store it in the c varaible.
  • Then We need to check if the given character is Alphabet, Digit or special character.
  • We are going to use the ctype.h library for checking the character. The ctype.h library contains the functions like isalpha() and isdigit().
    • The isalpha(ch) function takes Integer (which will be converted to ASCII value upon passing ) as a input. Returns a non-zero integer value if the given character ch is Alphabet.
    • Similarly, The isdigit(ch) function takes Integer as input. and Returns the non-zero Integer value if the given value is a digit.
  • By using the isalpha() and isdigit() functions we will check if the given input is an alphabet or Digit.
  • If given number is neither alphabet nor Digit, Then it must be Special character.

Check Character Program:

Program Output:


Related Programs:


Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

Leave a Reply