ispunct() in C

CProgrammingServer Side Programming

The function ispunct() is used to check that the passing character is a punctuation or not. It returns zero, if it is not a punctuation, otherwise it returns a non-zero value.

Here is the syntax of ispunct() in C language,

int ispunct(int character);

Here is an example of ispunct() in C language,

Example

 Live Demo

#include <stdio.h>
#include<ctype.h>
int main() {
   int a = '!';
   int b = 'a';
   if(ispunct(a))
   printf("The character is a punctuation.");
   else
   printf("\nThe character is not a punctuation.");
   if(ispunct(b))
   printf("\nThe character is a punctuation.");
   else
   printf("\nThe character is not a punctuation.");
   return 0;
}

Output

The character is a punctuation.
The character is not a punctuation.
raja
Updated on 24-Jun-2020 11:28:00

Advertisements