isdigit function > ctype.h > header files in c Programming

Syntax int isdigit (int c)
Header File ctype.h
Return Value
  • Return non-zero if c is  digit
  • Return zero if c is not digit

Live Example :
void main()
{
char ch = '1';
if( isdigit (ch))
       printf("\nThis is Digit");
else
       printf("\nThis is not a Digit");
}

Output : 
This is Digit

Explanation of statement : if(isdigit(ch))
  1. character ch is passed to function isdigit
  2. if ch belongs to the set of digits[0-9] then it returns non-zero value 
  3. otherwise it returns zero .
Note : 
  1. Positive non-zero value given to if block , will result in TRUE condition
  2. Zero value given to if block , will result in FALSE condition

Bookmark & Share

Get Updates Direct in Your Mail Box


0 comments

Post a Comment

Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email