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.