Name
ispunct
Synopsis
Ascertains whether a given character is a punctuation mark
#include <ctype.h> intispunct
( intc
);
The function ispunct()
tests whether its character argument is a punctuation mark. If the
character is a punctuation mark, ispunct()
returns a nonzero value (that
is, true
); if not, the function
returns 0 (false
).
The punctuation characters are dependent on the current locale
setting for the category LC_CTYPE
, which you can query or change
using the setlocale()
function.
In the default locale C
, the
punctuation characters are all of the graphic characters (those for
which isgraph()
is true), except
the alphanumeric characters (those for which isalnum()
is true).
Example
See the example for isprint()
in this
chapter.
Get C in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.