0
How to check a character whether it is alphanumeric or not in C language
5 Réponses
+ 10
Hào Đặng the other way of checking alphanumeric character without inbuilt function isalpha, isalnum. You can also acheive same task by comparing character with [a-zA-Z0-9] if any of these type of chracter match with the alphanumeric chracter set than that is an alphanumeric string. and if only one chractet present and other is not their than you need to make the comparison logic in the way where all this chracter presence is essential for being an alphanumeric string
+ 1
http://www.cplusplus.com/reference/cctype/
Use "ctype.h" header file.
0
if ((ch>='0' && ch<='9')
|| (ch>='A' && ch<='Z')
|| (ch>='a' && ch<='z'))
Or
#include <ctype.h>
if (isalnum((int)ch))