How to check a character whether it is alphanumeric or not in C language | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to check a character whether it is alphanumeric or not in C language

3rd Nov 2020, 6:46 PM
Hào Đặng
3 Answers
+ 9
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
3rd Nov 2020, 8:00 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 1
3rd Nov 2020, 7:52 PM
rodwynnejones
rodwynnejones - avatar
0
if ((ch>='0' && ch<='9') || (ch>='A' && ch<='Z') || (ch>='a' && ch<='z'))     Or #include <ctype.h> if (isalnum((int)ch))
3rd Nov 2020, 9:03 PM
Brian
Brian - avatar