Isdigit C Example - C

How to find if the passed character is a decimal digit in C?

Snippet Code


  
Rate this page :
  [ 0 votes]

Isdigit is a function in c. Here the isdigit is used to find whether a character is in numeric form or not. If the given value is not an numeric it returns as not a digit. The code given below is used to check whether your characters has a numeric value or not.

#include <stdio.h> int main() { char ch; printf("Enter any character\n"); scanf("%c", &ch); if(isdigit(ch)) { printf("Is Digit"); } else { printf("Not a Digit"); } return 0; }

Tags


Ask Questions

Ask Question