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
");

更新于:26-Jun-2020

101 次浏览

开启您的 职业道路

完成课程以获得认证

立即开始
广告
© . All rights reserved.