In C, iscntrl() is a predefined function used for string and character handling. ctype is the header file required for character functions. A control character is one that is not a printable character i.e, it does not occupy a printing position on a display.

This function is used to check if the argument contains any control characters. There are many types of control characters in C++ such as:

  1. Horizontal tab- ‘\t’
  2. **Line feed- **‘\n’
  3. **Backspace- **‘\b’
  4. **Carriage return- **‘\r’
  5. **Form feed- **‘\f’
  6. Escape
  7. **Alert Character- **‘\a’

The iscntrl() function checks whether a character passed to the function as an argument is a control character or not. If the character passed is a control character, then the function returns a non-zero integer i.e. the ASCII value of the corresponding character. If not, it returns 0.

According to the standard ASCII character set, control characters are between ASCII codes 0x00 (NUL), 0x1f (US), and 0x7f (DEL). Specific compiler implementations may define additional control characters for many specific platforms in the extended character set (above 0x7f).

#c programs #c

Program and syntax for iscntrl(int c) function in C
1.30 GEEK