C ctype isgraph() 函数
示例
检查字符是否有图形表示:
char c = '#';
if (isgraph(c)) {
printf("%c has a graphical representation", c);
} else {
printf("%c does not have a graphical representation", c);
}
亲自试一试 »
定义和用法
isgraph() 函数返回非零值(等同于布尔值 true),表示字符是否为图形表示。
图形字符示例:! " # $ % & ' ( ) * 等。
isgraph() 函数定义在 <ctype.h> 头文件中。
语法
int isgraph(int c);
参数值
| 参数 | 描述 |
|---|---|
| c | 必需。字符的 ASCII 值或实际字符 |
技术细节
| 返回值: | 一个 int 值,如果字符有图形表示,则该值为非零值(等同于布尔值 true)。否则返回 0(等同于布尔值 false)。 |
|---|

