ispunct

Header: <ctype.h>

Checks if the given character is a punctuation character in the current C locale. The default C locale classifies the characters !"#$%&’()*+,-./:;<=>?@[]^_`{|}~ as punctuation.

# Declarations

int ispunct( int ch );

# Parameters

# Return value

Non-zero value if the character is a punctuation character, zero otherwise.

# Example

#include <stdio.h>
#include <ctype.h>
#include <locale.h>
 
int main(void)
{
    unsigned char c = '\xd7'; // the character × (multiplication sign) in ISO-8859-1
    printf("In the default C locale, \\xd7 is %spunctuation\n",
           ispunct(c) ? "" : "not " );
    setlocale(LC_ALL, "en_GB.iso88591");
    printf("In ISO-8859-1 locale, \\xd7 is %spunctuation\n",
           ispunct(c) ? "" : "not " );
}

# See also