Right Click to Search

Sunday, January 24, 2025

isalpha function > ctype.h > header files in c Programming




isalpha function > ctype.h > header files in c Programming

Syntax
int isalpha (int c)
Header File
ctype.h
Return Value
  • Return non-zero if character is either alphabet
  • Return zero if character is not alphabet

Live Example :

void main()
{
char ch = '1';
if(isalpha(ch))
    printf("\nThis is alphabet character");
else
    printf("\nThis is non alphabet character");
}


Output : 
This is not alphabet character

Following are alphabet characters :
  1. Uppercase Letters [ A-Z]
  2. Lowercase Letters [a-z]
Explanation of statement : if(isalpha(ch))
  1. character ch is passed to function isalpha
  2. if ch belongs to the set of alphabet character then it returns positive value 
  3. otherwise it returns zero .
Note : 
  1. Positive non-zero value given to if block , will result in TRUE condition
  2. Zero value given to if block , will result in FALSE condition

Question
How we are passing character value to function , which contradicts to the Given Syntax ?
Answer

We are passing character to function , automatically gets converted into (int) equivalent ascii value  


    Bookmark & Share

    Stumble
    Delicious
    Technorati
    Twitter
    Facebook

    0 Comments:

    Post a Comment

    Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email

     

    Learn C Programming Copyright © 2010 LKart Theme is Designed by Lasantha, Free Blogger Templates