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