This blog is under construction

Saturday, 17 March 2012

isalnum example in C

Header file:
    ctype.h

Synopsis:
    int isalnum(int c)

Description:
    Checks whether the given input is an alphanumeric character or not.

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


isalnum function C example


  #include<stdio.h>
  #include<ctype.h>
  int main() {
        char c;
        printf("Enter your input:");
        c = getchar();

        if (isalnum(c))
                printf("The given input is alphanumberic\n");
        else
                printf("The given input is not alphanumeric\n");

        printf("The return value from isalnum: %d\n", isalnum(c));
        return 0;
  }



  Output:
  Enter your input:8
  The given input is alphanumberic
  The return value from isalnum: 8


No comments:

Post a Comment