This blog is under construction

Saturday 17 March 2012

ispunct example in C

Header file:
    ctype.h

Synopsis:
    int ispunct (int input)

Description:
    Checks whether the given input is a punctuation character or not.

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


ispunct function C example:


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

        if (ispunct(c))
                printf("Given input is a punctuation\n");
        else
                printf("Not a punctuation\n");

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



  Output:
  Enter your input:!
  Given input is a punctuation
  Return value from ispunct: 4

No comments:

Post a Comment