Function name : isdigit
Header file : <ctype.h>
Function prototype : int isdigit(int ch);
Function : Determine whether the character is a decimal number
Parameters : int ch character to be checked
Return value : If ch is not a decimal number, return 0. If ch is a decimal number, return non-0.
Program example : Determine whether the entered character is a decimal number
#include<ctype.h>#include<stdio.h>intmain(){charch;printf(inputacharacter:);scanf(%c,&ch);if(isdigit(ch)){printf(%cisdigit.,ch) ;}else{printf(%cisnotdigit.,ch);}putchar('n');return0;}
Running results:
inputacharacter:55isdigit.