C Library Function ispunct( )

In this tutorial, you will learn about C library function ispunct() which is a character handling function used to check whether the argument supplied is a printing character other than space, a digit or a letter.

As discussed earlier, we have to include ctype.h header file for using ispunct( ) standard character library function.

#include <ctype.h>

C Library Function ispunct( ): Function prototype

int ispunct( int ch);

This function checks whether its argument ch is a printing character other than space, a digit or a letter.

Punctuation characters$, #, (, ), [, ], {, }, ;, : or %

This function returns a true value if its argument is a printings character and zero (0) otherwise.

Demonstration of ispunct():
: is a punctuation character
[ is a punctuation character
G is not a punctuation character

Explanation
In this example, we have used if...else statements instead of a conditional operator.

Here, if...else statement does the selection between two strings.

Related Articles:

C library function isalnum( ) In this tutorial, you will learn about C library function isalnum() which is a character handling function used to check whether...

C Library Function isgraph( ) In this tutorial, you will learn about C library function isgraph() which is a character handling function used to check whether the argument supplied is a printing...

C Library Function isprint( ) In this tutorial, you will learn about C library function isprint() which is a character handling function used to check whether its argument can be displayed...

C Library Function isxdigit( ) In this tutorial, you will learn about C library function isxdigit() which is a character handling function used to check whether the argument supplied is a hexadecimal character or...