In the C Programming Language, the isprint feature checks whether c is a printing character and it does include a space. If you do not want to include a space, attempt the use of the isgraph function.
Syntax
The syntax for the isprint feature in the C Language is:
int isprint(int c);
Parameters or Arguments
c The price to test whether it is a printing personality and it does encompass a space.
Returns
The isprint feature returns a nonzero fee if c is a printing persona and returns zero if c is now not a printing character.
Required Header
In the C Language, the required header for the isprint function is:
#include <ctype.h>
Applies To
In the C Language, the isprint feature can be used in the following versions:
ANSI/ISO 9899-1990
isprint Example
/* Example using isprint by TechOnTheNet.com */
#include <stdio.h>
#include <ctype.h>
int main(int argc, const char * argv[])
{
/* Define a temporary variable */
unsigned char test;
/* Assign a test printable letter to the variable */
test = 'T';
/* Test to see if this character is a printing character */
if (isprint(test) != 0) printf("%c is a printing character\n", test);
else printf("%c is not a printing character\n", test);
/* Assign a non-printing character to the variable */
test = 0; /* This is NUL */
/* Test to see if this character is a printing character */
if (isprint(test) != 0) printf("NUL is a printing character\n");
else printf("NUL is not a printing character\n");
return 0;
}
When compiled and run, this application will output:
T is a printing character
NUL is not a printing character
Similar Functions
Other C features that are comparable to the isprint function:
iscntrl function isgraph feature isspace characteristic
Leave a Review