The C ispunct function is used to check whether the given character is a Punctuation or not. For example, the below function accepts a character as the parameter and finds whether it is Punctuation or not.
ispunct(char)
The ispunct function finds whether the user-given character is a Punctuation or not.
#include <stdio.h>
#include <ctype.h>
int main()
{
char ch = '!';
if(ispunct(ch))
{
printf("\nYou have entered a Punctuation Character \n");
}
else
{
printf("\n %c is not a Punctuation", ch);
}
return 0;
}
You have entered a Punctuation
ispunct Example 2
This program allows users to enter any letter. And check whether the given character is a Punctuation or not using the Programming ispunct function.
#include <stdio.h>
#include <ctype.h>
int main()
{
char ch;
printf("Please Enter Any Valid Character: ");
scanf("%c", &ch);
if(ispunct(ch))
{
printf("\nYou have entered a Punctuation Character \n");
}
else
{
printf("\n %c is not a Punctuation Character \n", ch);
}
return 0;
}

Let me enter another character.
Please Enter Any Valid Character: i
i is not a Punctuation Character