Differentiate printable and control character in C ? Last Updated : 05 Sep, 2017 Summarize Comments Improve Suggest changes Share Like Article Like Report Given a character we need to find if it printable or not. We also need to find if it is control character or not. A character is known as printable character if it occupies printing space. For the standard ASCII character set (used by the "C" locale), control characters are those between ASCII codes 0x00 (NUL) and 0x1f (US), plus 0x7f (DEL). Examples: Input : a Output :a is printable character a is not control character Input :\r Output : is not printable character is control character To find the difference between a printable character and a control character we can use some predefined functions, which are declared in the "ctype.h" header file. The isprint() function checks whether a character is a printable character or not. isprint() function takes single argument in the form of an integer and returns a value of type int. We can pass a char type argument internally they acts as a int by specifying ASCII value. The iscntrl() function is used to checks whether a character is a control character or not. iscntrl() function also take a single argument and return an integer. CPP // C program to illustrate isprint() and iscntrl() functions. #include <stdio.h> #include <ctype.h> int main(void) { char ch = 'a'; if (isprint(ch)) { printf("%c is printable character\n", ch); } else { printf("%c is not printable character\n", ch); } if (iscntrl(ch)) { printf("%c is control character\n", ch); } else { printf("%c is not control character", ch); } return (0); } Output: a is printable character a is not control character Comment More infoAdvertise with us Next Article Data type of character constants in C and C++ B Bishal Dubey Improve Article Tags : C Language C-Library Similar Reads Data type of character constants in C and C++ In C, data type of character constants is int, but in C++, data type of same is char. If we save below program as test.c then we get 4 as output (assuming size of integer is 4 bytes) and if we save the same program as test.cpp then we get 1(assuming size of char is 1 byte) C++ // C++ program demonst 1 min read Difference Between Constants and Variables in C The constants and variables in C are both used to store data. So it is essential to know the difference between the variables and constants in C so that we can decide which one to use based on the situation. In this article, we will discuss the basic difference between a constant and a variable in C 3 min read Difference Between Constants and Variables in C The constants and variables in C are both used to store data. So it is essential to know the difference between the variables and constants in C so that we can decide which one to use based on the situation. In this article, we will discuss the basic difference between a constant and a variable in C 3 min read Difference between NULL pointer, Null character (' Like