This blog is under construction

Saturday, 17 March 2012

isxdigit example in C

Header file:
    ctype.h

Synopsis:
    int isxdigit (int input)

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

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


isxdigit function C example:


  #include<stdio.h>
  #include<ctype.h>
  int main() {
        char c;
        printf("Enter your input:");
        c = getchar();
        /* 0-9 & A-F -hexadecimal digits */
        if (isxdigit(c))
                printf("The given input is a hexadecimal digit\n");
        else
                printf("not an hexadecimal digit\n");

        printf("Return value of isxdigit:%d\n", isxdigit(c));
        return 0;
  }



  Output:
  Enter your input: F
  The given input is a hexadecimal digit
  Return value of isxdigit:4096



No comments:

Post a Comment