C programming ctype.h function - int isgraph(int c)

The int isgraph(int c) function in the ctype.h library of C programming is used to determine whether a given character is a printable character that is not a space.

The isgraph() function takes a single integer argument c, which is the character to be checked. The function returns an integer value, which is nonzero if the character is a printable character other than space, and zero otherwise.

Here's an example of how to use the isgraph() function in C:

#include <stdio.h>
#include <ctype.h>

int main() {
    char c = '!';
    if (isgraph(c)) {
        printf("%c is a printable character other than space\n", c);
    } else {
        printf("%c is not a printable character other than space\n", c);
    }
    return 0;
}
Sour‮w:ec‬ww.theitroad.com

In this example, the isgraph() function is used to check whether the character '!' is a printable character other than space. Since '!' is a printable character other than space, the function returns a nonzero value, and the output will be: '!' is a printable character other than space'.

If the character had been a space character such as ' ', the isgraph() function would return zero, and the output would be: ' ' is not a printable character other than space'.