作者:月雨淅淅 | 来源:互联网 | 2023-10-12 13:29
C库函数void isgraph(int c) 检查,如果字符的图形表示。
用图形表示的字符是所有可打印的字符,除空白字符(如''),这是不考虑为isgraph字符。
声明
以下是isgraph()函数的声明。
int isgraph(int c);
参数
返回值
这个函数返回非零值,如果c具有图形表示字符,否则为0
实例
下面的例子演示了如何使用isgraph()函数。
#include#includeint main(){int var1 ='3';int var2 ='m';int var3 =' ';if( isgraph(var1)){
printf("var1 = |%c| can be printed
", var1 );}else{
printf("var1 = |%c| can't be printed
", var1 );}if( isgraph(var2)){
printf("var2 = |%c| can be printed
", var2 );}else{
printf("var2 = |%c| can't be printed
", var2 );}if( isgraph(var3)){
printf("var3 = |%c| can be printed
", var3 );}else{
printf("var3 = |%c| can't be printed
", var3 );}return(0);}
让我们编译和运行上面的程序,这将产生以下结果:
var1 = |3| can be printed
var2 = |m| can be printed
var3 = | | can't be printed