You are here : Cctype.hiscntrl

iscntrl() - ctype.h

The C library function void 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).

This function returns non-zero value if c is a control character, else it returns 0.


Syntax

int iscntrl(int c);


Example

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


Output / Return Value

all tutorials


Limitations


Alternatives / See Also


Reference