isgraph() 함수는 전달된 문자에 그래픽 표현이 있는지 확인하는 데 사용됩니다. "ctype.h" 헤더 파일에 선언되어 있습니다.
다음은 C 언어의 isgraph() 구문입니다.
int isgraph(int char);
다음은 C 언어로 된 isgraph()의 예입니다.
예시
#include<stdio.h>
#include<ctype.h>
int main() {
int a = '\n';
int b = '8';
int c = 's';
if(isgraph(a))
printf("The character has graphical representation\n");
else
printf("The character isn’t having graphical representation\n");
if(isgraph(b))
printf("The character has graphical representation\n");
else
printf("The character isn’t having graphical representation");
if(isgraph(c))
printf("The character has graphical representation\n");
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
위의 프로그램에서는 3개의 변수를 선언하고 초기화합니다. 이 변수들은 그래픽 표현이 있는지 isgraph() 함수를 사용하지 않는지 확인합니다.
if(isgraph(a))
printf("The character has graphical representation\n");
else
printf("The character isn’t having graphical representation\n");