Professional Documents
Culture Documents
C Isalnum - C Standard Library
C Isalnum - C Standard Library
h/isalnum
C isalnum()
The isalnum() function checks whether the argument
passed is an alphanumeric character (alphabet or
number) or not.
isalnum() Parameters
• argument - a character
1 of 3 9/9/2022, 10:19 PM
Firefox https://www.programiz.com/c-programming/library-function/ctype.h/isalnum
#include <stdio.h>
#include <ctype.h>
int main()
{
char c;
int result;
c = '5';
result = isalnum(c);
printf("When %c is passed, return value is %d\n", c, result);
c = 'Q';
result = isalnum(c);
printf("When %c is passed, return value is %d\n", c, result);
c = 'l';
result = isalnum(c);
printf("When %c is passed, return value is %d\n", c, result);
c = '+';
result = isalnum(c);
printf("When %c is passed, return value is %d\n", c, result);
return 0;
}
Output
2 of 3 9/9/2022, 10:19 PM
Firefox https://www.programiz.com/c-programming/library-function/ctype.h/isalnum
#include <stdio.h>
#include <ctype.h>
int main()
{
char c;
printf("Enter a character: ");
scanf("%c", &c);
if (isalnum(c) == 0)
printf("%c is not an alphanumeric character.", c);
else
printf("%c is an alphanumeric character.", c);
3 of 3 9/9/2022, 10:19 PM