[Previous]
[Contents]
[Next]

ispunct()

test for any punctuation character

Synopsis:

#include <ctype.h>
int ispunct( int c );

Description:

The ispunct() function tests for any punctuation character such as a comma (,) or a period (.).

Returns:

A nonzero value when the argument is a punctuation character, otherwise zero.

Examples:

#include <stdio.h>
#include <ctype.h>

char chars[] = {'A', '!', '.', ',', ':', ';'};

#define SIZE sizeof( chars ) / sizeof( char )

void main()
  {
    int   i;

    for( i = 0; i < SIZE; i++ ) {
      printf( "Char %c is %sa punctuation character\n",
        chars[i],
        ( ispunct( chars[i] ) ) ? "" : "not " );
    }
  }

produces the output

Char A is not a punctuation character
Char ! is a punctuation character
Char . is a punctuation character
Char , is a punctuation character
Char : is a punctuation character
Char ; is a punctuation character

Classification:

ANSI

Safety:
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

isalnum(), isalpha(), iscntrl(), isdigit(), isgraph(), islower(), isprint(), isspace(), isupper(), isxdigit()


[Previous]
[Contents]
[Next]