ispunct() in C


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("
The character is not a punctuation.");    if(ispunct(b))    printf("
The character is a punctuation.");    else    printf("
The character is not a punctuation.");    return 0; }

Output

The character is a punctuation.
The character is not a punctuation.

Updated on: 24-Jun-2020

86 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements