![]() |
VOOZH | about |
isalnum() function in C programming language checks whether the given character is alphanumeric or not. isalnum() function defined in ctype.h header file. Alphanumeric: A character that is either a letter or a number. Syntax:
int isalnum(int x);
Examples:
Input : 1 Output : Entered character is alphanumeric Input : A Output : Entered character is alphanumeric Input : & Output : Entered character is not alphanumeric
Output:
Entered character is alphanumeric
isalnum() function returns some value. It always returns '8' for all characters except special characters like (#,@,% etc.). It will always return '0' for special characters.
Input: 'A'
Output: 8
Input: 'b'
Output:8
Input: '4'
Output: 8
Input: '#'
Output: 0
Input: '?'
Output: 0
Application: isalnum() function is used to find out number of alphanumeric in a given sentence(or any input). Example:
Input: abc123@ Output: Number of alphanumerics in the given input is : 6 Input: a@# Output: Number of alphanumerics in the given input is : 1 Input: ...akl567 Output: Number of alphanumerics in the given input is : 6
Output:
Number of alphanumerics in the given input is : 19