isalpha function > ctype.h > header files in c Programming
| Syntax | int isalpha (int c) |
| Header File | ctype.h |
| Return Value |
|
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 characterFollowing are alphabet characters :
- Uppercase Letters [ A-Z]
- Lowercase Letters [a-z]
Explanation of statement :
if(isalpha(ch))- character ch is passed to function isalpha
- if ch belongs to the set of alphabet character then it returns positive value
- otherwise it returns zero .
Note :
- Positive non-zero value given to if block , will result in TRUE condition
- 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
