iscntrl

Header: <ctype.h>

Checks if the given character is a control character, i.e. codes 0x00-0x1F and 0x7F.

# Declarations

int iscntrl( int ch );

# Parameters

# Return value

Non-zero value if the character is a control character, zero otherwise.

# Example

#include <stdio.h>
#include <ctype.h>
#include <locale.h>
 
int main(void)
{
    unsigned char c = '\x94'; // the control code CCH in ISO-8859-1
    printf("In the default C locale, \\x94 is %sa control character\n",
           iscntrl(c) ? "" : "not " );
    setlocale(LC_ALL, "en_GB.iso88591");
    printf("In ISO-8859-1 locale, \\x94 is %sa control character\n",
           iscntrl(c) ? "" : "not " );
}

# See also