ispunct() Test for Punctuation Character
#include <ctype.h>
int ispunct(c);
int c; Integer value to be tested
ispunct() tests if 'c' is a punctuation character. A punctuation
character is one that is not alphabetic, not numeric, not a control
character, and not a white space.
Returns: True (nonzero) if the integer satisfies the test
condition or false (zero) if it does not. The result is
undefined if 'c' is other than an ASCII character or EOF.
Notes: ispunct() is a macro.
-------------------------------- Example ---------------------------------
The following statements print out the contents of a string, putting
in a new-line character after each punctuation character.
#include <ctype.h>
char *buffer;
int c;
int x;
main()
{
buffer = "If you go down to the woods today...";
for (x = 0; x < strlen(buffer); x++)
if (ispunct(buffer[x])) {
fputchar(buffer[x]);
fputchar('\n');
}
else if (isprint(buffer[x]))
fputchar(buffer[x]);
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster