该函数ispunct()用于检查传递的字符是否为标点符号。如果不是标点符号,则返回零,否则返回非零值。
这是ispunct()C语言的语法,
int ispunct(int character);
这是ispunct()C语言的示例,
#include <stdio.h>
#include<ctype.h>
int main() {
int a = '!';
int b = 'a';
if(ispunct(a))
printf("字符是标点符号。");
else
printf("\nThe character is not a punctuation.");
if(ispunct(b))
printf("\n字符是标点符号。");
else
printf("\nThe character is not a punctuation.");
return 0;
}输出结果
字符是标点符号。 The character is not a punctuation.