CKTIS / C
isgraph — C23 character classification function
`isgraph(c)` from `<ctype.h>` returns a nonzero value for a printing character other than space in the current locale. It therefore covers characters that leave a visible mark—letters, digits, and punctuation—but excludes the spacing character and control characters.
Version: C23
Syntax
int isgraph(int c);isgraph(c) from <ctype.h> returns a nonzero value for a printing character other than space in the current locale. It therefore covers characters that leave a visible mark—letters, digits, and punctuation—but excludes the spacing character and control characters.
The example tests A, !, space, and \n, normalizing with != 0. Output 1 1 0 0 demonstrates a visible letter and punctuation mark, then rejection of the printable space and the nonprinting line ending.
The argument must be EOF or representable as unsigned char; a negative plain char causes undefined behavior. For a byte use isgraph((unsigned char)ch), handling EOF separately. Classification of additional bytes depends on LC_CTYPE; the function does not recognize Unicode grapheme clusters or display width.
Examples
#include <ctype.h>
#include <stdio.h>
int main(void){int values[]={'A','!',' ','\n'};printf("%d %d %d %d\n",isgraph(values[0])!=0,isgraph(values[1])!=0,isgraph(values[2])!=0,isgraph(values[3])!=0);return 0;}
Result
1 1 0 0
The example tests `A`, `!`, space, and `\n`, normalizing with `!= 0`. Output `1 1 0 0` demonstrates a visible letter and punctuation mark, then rejection of the printable space and the nonprinting line ending.