C Data Type Functions - C isgraph

Determines if a character is printable, excluding the space (decimal 32).


int isgraph( int ch );


ch - character to classify

Return value

Non-zero value if the character has a graphical representation character, zero otherwise.


#include <stdio.h>
#include <ctype.h>
#include <locale.h>
 /*www .j  ava 2 s . c o  m*/
int main(void)
    unsigned char c = '\xb6'; // the character ? in ISO-8859-1
    printf("In the default C locale, \\xb6 is %sgraphical\n",
           isgraph(c) ? "" : "not " );
    setlocale(LC_ALL, "en_GB.iso88591");
    printf("In ISO-8859-1 locale, \\xb6 is %sgraphical\n",
           isgraph(c) ? "" : "not " );

The code above generates the following result.