ispunct, iswpunct, _ismbcpunct
Remonter à Ctype.h - Index
Header File
ctype.h, wctype.h, mbstring.h
Category
Classification Routines
Prototype
int ispunct(int c);
int iswpunct(wint_t c);
int _ismbcpunct(unsigned int c);
Description
Tests for punctuation character.
ispunct is a macro that classifies ASCII-coded integer values by table lookup. The macro is affected by the current locale’s LC_CTYPE category. For the default C locale, c is any printing character that is neither an alphanumeric nor a blank space (‘ ‘).
You can make this macro available as a function by undefining (#undef) it.
Return Value
ispunct returns nonzero if c is a punctuation character.
Example
#include <stdio.h>
#include <ctype.h>
int main(void)
{
char c = 'C';
if (ispunct(c))
printf("%c is a punctuation character\n",c);
else
printf("%c is not a punctuation character\n",c);
return 0;
}
Portability
POSIX | Win32 | ANSI C | ANSI C++ | |
---|---|---|---|---|
ispunct |
+ |
+ |
+ |
+ |
_ismbcpunt |
+ |
|||
iswpunct |
+ |
+ |
+ |