ispunct() in C
函数ispunct()用于检查传递的字符是否为标点符号。 如果不是标点符号,则返回零,否则返回非零值。
这是用C语言编写的ispunct()的语法,
1 | int ispunct(int character); |
这是C语言中ispunct()的示例,
例
现场演示
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <stdio.h> #include<ctype.h> int main() { int a = '!'; int b = 'a'; if(ispunct(a)) printf("The character is a punctuation."); else printf(" The character is not a punctuation."); if(ispunct(b)) printf(" The character is a punctuation."); else printf(" The character is not a punctuation."); return 0; } |
输出量
1 2 | The character is a punctuation. The character is not a punctuation. |