isgraph() C 库函数
isgraph() 函数用于检查传入的字符是否具有图形化表示形式。它声明在“ctype.h”头文件中。
下面是 isgraph() 在 C 语言中的语法:
int isgraph(int char);
下面是 isgraph() 在 C 语言中的示例:
示例
#include<stdio.h>
#include<ctype.h>
int main() {
int a = '
';
int b = '8';
int c = 's';
if(isgraph(a))
printf("The character has graphical representation
");
else
printf("The character isn’t having graphical representation
");
if(isgraph(b))
printf("The character has graphical representation
");
else
printf("The character isn’t having graphical representation");
if(isgraph(c))
printf("The character has graphical representation
");
else
printf("The character isn’t having graphical representation");
return 0;
}输出
The character isn’t having graphical representation The character has graphical representation The character has graphical representation
在上面的程序中,我们声明并初始化了三个变量。这些变量检查它们是否使用 isgraph() 函数进行图形化表示。
if(isgraph(a))
printf("The character has graphical representation
");
else
printf("The character isn’t having graphical representation
");
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 语言编程
C++
C#
MongoDB
MySQL
Javascript
PHP