isgraph() C library function


The function isgraph() is used to check that the passed character has a graphical representation or not. It is declared in “ctype.h” header file.

Here is the syntax of isgraph() in C language,

int isgraph(int char);

Here is an example of isgraph() in C language,

Example

 Live Demo

#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; }

Output

The character isn’t having graphical representation
The character has graphical representation
The character has graphical representation

In the above program, Three variables are declared and initialized. These variables are checked that they have graphical representation or not using isgraph() function.

if(isgraph(a))
printf("The character has graphical representation
"); else printf("The character isn’t having graphical representation
");

karthikeya Boyini
karthikeya Boyini

I love programming (: That's all I know

Updated on: 26-Jun-2020

85 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements