C 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 :

int iscntrl(int ch);

iscntrl() Example

Following program checks each character read from stdin and reports all control characters :

void main()
	char ch;
	for(; ;)
		ch = getchar();
		if(ch == '.')
			printf("%c is a control char\n", ch);

C Online Test

« Previous Chapter Next Function »

Like/Share Us on Facebook 😋