This blog post explains the non printable characters with their ASCII (American Standard Code for Information Interchange) value in decimal and hex format. The non-printing characters are characters for content designing in word processors, which are not displayed at printing.
Table of non-printable ASCII characters:
The following table contains the non-printable characters with their ASCII value in decimal and hex format.
| Non Printable Characters | |||||
| DEC | HEX | CHARACTER (CODE) | DEC | HEX | CHARACTER (CODE) |
| 0 | 0 | NULL | 16 | 10 | DATA LINK ESCAPE (DLE) |
| 1 | 1 | START OF HEADING (SOH) | 17 | 11 | DEVICE CONTROL 1 (DC1) |
| 2 | 2 | START OF TEXT (STX) | 18 | 12 | DEVICE CONTROL 2 (DC2) |
| 3 | 3 | END OF TEXT (ETX) | 19 | 13 | DEVICE CONTROL 3 (DC3) |
| 4 | 4 | END OF TRANSMISSION (EOT) | 20 | 14 | DEVICE CONTROL 4 (DC4) |
| 5 | 5 | END OF QUERY (ENQ) | 21 | 15 | NEGATIVE ACKNOWLEDGEMENT (NAK) |
| 6 | 6 | ACKNOWLEDGE (ACK) | 22 | 16 | SYNCHRONIZE (SYN) |
| 7 | 7 | BEEP (BEL) | 23 | 17 | END OF TRANSMISSION BLOCK (ETB) |
| 8 | 8 | BACKSPACE (BS) | 24 | 18 | CANCEL (CAN) |
| 9 | 9 | HORIZONTAL TAB (HT) | 25 | 19 | END OF MEDIUM (EM) |
| 10 | A | LINE FEED (LF) | 26 | 1A | SUBSTITUTE (SUB) |
| 11 | B | VERTICAL TAB (VT) | 27 | 1B | ESCAPE (ESC) |
| 12 | C | FF (FORM FEED) | 28 | 1C | FILE SEPARATOR (FS) RIGHT ARROW |
| 13 | D | CR (CARRIAGE RETURN) | 29 | 1D | GROUP SEPARATOR (GS) LEFT ARROW |
| 14 | E | SO (SHIFT OUT) | 30 | 1E | RECORD SEPARATOR (RS) UP ARROW |
| 15 | F | SI (SHIFT IN) | 31 | 1F | UNIT SEPARATOR (US) DOWN ARROW |
Now let’s see a C program to validate the above-mentioned non-printable characters.
Now you are thinking about how I will validate?
The answer to your question is that I will use the isprint function for each character. The isprint is a library function that returns a non-zero value if the argument is a printable character.
In the following code, I am creating an array of ASCII code for non-printing characters and validating each character through the isprint library function in a “for loop“.
#include <stdio.h>
#include <ctype.h>
int main()
{
int i = 0;
//ASCII value of all non-printable character
int asciiValue[] =
{
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,
17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
};
//Get array size
const int arraySize = sizeof(asciiValue)/sizeof(asciiValue[0]);
// looping through all elements of array
for (i = 0; i < arraySize; ++i)
{
if(isprint(asciiValue[i])!= 0)
{
//print
printf("%c ", asciiValue[i]);
}
}
return 0;
}
Output:
Nothing will be printed.

Recommended Post:
- C Programming Courses And Tutorials.
- CPP Programming Courses And Tutorials.
- How to use ispunct function in C programming?
- tolower function in C.
- How to use the islower function in C?
- Use of iscntrl function in C.
- How to use isalpha function in C programming?
- Use isalnum function in C programming?
- How to use isdigit function in C programming?
- How to use sizeof operator in C.
- _Alignof or alignof Operator in C
- Alignment specifiers in C ( _Alignas).
- Function Specifiers in C.
- Type qualifiers in C.
- Punctuators in C.
- Elements of C language.