isalnum function > ctype.h > header files in c Programming
isalnum function > ctype.h > header files in c Programming
| Syntax | int isalnum (int c) |
| Header File | ctype.h |
| Return Value |
|
Live Example :
void main()
{
char ch = '1';
if(isalnum(ch))
printf("nThis is alpha-numeric character");
else
printf("nThis is non alpha-numeric character");
}
Output :
This is alpha-numeric character
Following are alph-numeric character :
- Uppercase Letters [ A-Z]
- Lowercase Letters [a-z]
- Digits [0-9]
Explanation of statement :
if(isalnum(ch))- character ch is passed to function isalnum
- if ch belongs to the set of alpha-numeric 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