C Data Type Functions - C iscntrl






Determines if a character is a control or delete character.

Prototype

int iscntrl( int ch );

Parameters

ch - character to classify

Return value

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

Example


#include <stdio.h>
#include <ctype.h>
#include <locale.h>
 //from  w ww.ja va2  s  .c  o m
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 " );
}

The code above generates the following result.