Function name : iscntrl
Header file : <ctype.h>
Function prototype : int iscntrl(int ch);
Function : Determine whether a character is a control character
Parameters : int ch character to be checked
Return value : If ch is not a control character, return 0; if ch is a control character, return non-0.
Program example : Determine whether the entered character is a control character
#include<ctype.h>#include<stdio.h>#include<conio.h>intmain(){charch;printf(inputacharacter:);ch=getche();if(iscntrl(ch)){printf( n%c%discontrolcharacter.,ch,ch);}else{printf(n%c%disnotcontrolcharacter.,ch,ch);}putchar('n');return0;}
Running results:
inputacharacter:26iscontrolcharacter.