This blog is under construction

Saturday, 17 March 2012

isalpha example in C

Header file:
    ctype.h

Synopsis:
    int isalpha (int input)   

Description:
    Checks whether a given input is an alphabetic character or not.

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


isalpha function C example


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

        if (isalpha(c))
                printf("The given input is an alphabet\n");
        else
                printf("The given input is not an alphabet\n");

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



  Output:
  Enter your input:1
  The given input is not an alphabet
  Return value of isalpha: 0


No comments:

Post a Comment