codescracker


c

C iscntrl()



« Previous Chapter Next Function »


iscntrl()

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.

iscntrl() Syntax

Following is the syntax of the iscntrl() function :

#include<ctype.h>
int iscntrl(int ch);

iscntrl() Example

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();
}

« Previous Chapter Next Function »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test