- The C Standard Library
- C Library - Home
- C Library - <assert.h>
- C Library - <ctype.h>
- C Library - <errno.h>
- C Library - <float.h>
- C Library - <limits.h>
- C Library - <locale.h>
- C Library - <math.h>
- C Library - <setjmp.h>
- C Library - <signal.h>
- C Library - <stdarg.h>
- C Library - <stddef.h>
- C Library - <stdio.h>
- C Library - <stdlib.h>
- C Library - <string.h>
- C Library - <time.h>
- C Standard Library Resources
- C Library - Quick Guide
- C Library - Useful Resources
- C Library - Discussion
- C Programming Resources
- C Programming - Tutorial
- C - Useful Resources
C library function - iscntrl()
Description
The C library function int iscntrl(int c) checks if the passed character is a control character.
According to standard ASCII character set, control characters are between ASCII codes 0x00 (NUL), 0x1f (US), and 0x7f (DEL). Specific compiler implementations for certain platforms may define additional control characters in the extended character set (above 0x7f).
Declaration
Following is the declaration for iscntrl() function.
int iscntrl(int c);
Parameters
c − This is the character to be checked.
Return Value
This function returns non-zero value if c is a control character, else it returns 0.
Example
The following example shows the usage of iscntrl() function.
#include <stdio.h> #include <ctype.h> int main () { int i = 0, j = 0; char str1[] = "all \a about \t programming"; char str2[] = "tutorials \n point"; /* Prints string till control character \a */ while( !iscntrl(str1[i]) ) { putchar(str1[i]); i++; } /* Prints string till control character \n */ while( !iscntrl(str2[j]) ) { putchar(str2[j]); j++; } return(0); }
Let us compile and run the above program, to produce the following result −
all tutorials
ctype_h.htm
Advertisements