C Language: isgraph function
(Test for Graphical Character)
In the C Programming Language, the isgraph function tests whether c is a printing character, but does not include a space. If you wish to include a space, try using the isprint function.
Syntax
The syntax for the isgraph function in the C Language is:
int isgraph(int c);
Parameters or Arguments
- c
- The value to test whether it is a printing character, but does not include a space.
Returns
The isgraph function returns a nonzero value if c is a printing character and returns zero if c is not a printing character.
Required Header
In the C Language, the required header for the isgraph function is:
#include <ctype.h>
Applies To
In the C Language, the isgraph function can be used in the following versions:
- ANSI/ISO 9899-1990
isgraph Example
/* Example using isgraph by TechOnTheNet.com */ #include <stdio.h> #include <ctype.h> int main(int argc, const char * argv[]) { /* Define a temporary variable */ unsigned char test; /* Assign a test printable letter to the variable */ test = 'T'; /* Test to see if this character is a printing character */ if (isgraph(test) != 0) printf("%c is a printing character\n", test); else printf("%c is not a printing character\n", test); /* Assign a non-printing character to the variable */ test = 0; /* This is NUL */ /* Test to see if this character is a printing character */ if (isgraph(test) != 0) printf("NUL is a printing character\n"); else printf("NUL is not a printing character\n"); return 0; }
When compiled and run, this application will output:
T is a printing character NUL is not a printing character
Similar Functions
Other C functions that are similar to the isgraph function:
Advertisements