The iscntrl() function returns non-zero if ch is a control character, which is ASCII environments is a value between zero and 0x1F, or equal to 0x7F (DEL). Otherwise zero is returned.
Following is the syntax of the iscntrl() function :
#include<ctype.h> int iscntrl(int ch);
Following program checks each character read from stdin and reports all control characters :
#include<ctype.h> #include<stdio.h> #include<conio.h> void main() { clrscr(); char ch; for(; ;) { ch = getchar(); if(ch == '.') break; if(iscntrl(ch)) printf("%c is a control char\n", ch); } getch(); }