fastread homefastrread library fastread menu

C : Check Whether a Character is an Alphabet or not

Tutorial by:Manisha Dubey      Date: 2016-06-17 03:16:36

❰ Previous Next ❱

In this example, you will learn to check whether a character entered by the user is an alphabet or not.

Example: Program to Check Alphabet

#include <stdio.h>
int main()
    char c;
    printf("Enter a character: ");

    if( (c>='a' && c<='z') || (c>='A' && c<='Z'))
        printf("%c is an alphabet.",c);
        printf("%c is not an alphabet.",c);

    return 0;


Enter a character: *
* is not an alphabet

In C programming, A character variable holds ASCII value (an integer number between 0 and 127) rather than that character itself.

The ASCII value of lowercase alphabets are from 97 to 122. And, the ASCII value of uppercase alphabets are from 65 to 90.


If the ASCII value of the character entered by the user lies in the range from 97 to 122 or from 65 to 90, that number is an alphabet. In the program,'a' is used instead of 97, 'z' is used instead of 122, 'A' is used instead of 65 and 'Z' is used instead of 90.

You can also check whether a character is an alphabet or not using isalpha() function.

❰ Previous Next ❱


Submit Your Thought, Tutorial, Articls etc.

Submit Your Information India's Number one online promotion website