This blog is under construction

Saturday, 17 March 2012

isdigit example in C

Header file:
    ctype.h

Synopsis:
    int isdigit (int input)

Description:
    Checks whether the given input is a decimal digit or not

Return Value:
    TRUE(non-zero value) on success
    0 on failure.


isdigit function C example


  #include<stdio.h>
  #include<ctype.h>
  int main() {
        char c;
        printf("Enter your input:");
        c = getchar();
        if (isdigit(c))
                printf("The given input is a decimal digit\n");
        else
                printf("The given input is not a decimal digit\n");
        printf("Return value of isdigit: %d\n", isdigit(c));
        return 0;
  }




  Output:
  Enter your input:1
  The given input is a decimal digit
  Return value of isdigit: 2048

No comments:

Post a Comment