isalnum function is used to determine weather entered character is alpha-numeric or not.Let us see example for this program.
Example:
#include<stdio.h>
#include<conio.h>
#include<ctype.h>
main()
{
char ch;
clrscr();
printf("Enter any character: ");
scanf("%c",&ch);
if(isalnum(ch))
{
printf("\nThis character is alpha-numeric");
}
else
{
printf("\nThis character is not alpha-numeric");
}
getch();
}
Example:
#include<stdio.h>
#include<conio.h>
#include<ctype.h>
main()
{
char ch;
clrscr();
printf("Enter any character: ");
scanf("%c",&ch);
if(isalnum(ch))
{
printf("\nThis character is alpha-numeric");
}
else
{
printf("\nThis character is not alpha-numeric");
}
getch();
}