In the C Programming Language, the ispace function assessments whether or not c is a white-space character such as area (‘ ‘), structure feed (‘\f’), new line (‘\n’), carriage return (‘\r’), horizontal tab (‘\t’),and vertical tab (‘\v’).
Syntax
The syntax for the isspace characteristic in the C Language is:
int isspace(int c);
Parameters or Arguments
c The cost to test whether it is a white-space personality such as area (‘ ‘), structure feed (‘\f’), new line (‘\n’), carriage return (‘\r’), horizontal tab (‘\t’),and vertical tab (‘\v’).
Returns
The isspace function returns a nonzero price if c is a white-space persona and returns zero if c is no longer a white-space character.
Required Header
In the C Language, the required header for the isspace function is:
#include <ctype.h>
Applies To
In the C Language, the isspace feature can be used in the following versions:
ANSI/ISO 9899-1990
isspace Example
/* Example using isspace 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 space character to the variable */
test = '\t'; /* This is a tab character */
/* Test to see if this character is a space character */
if (isspace(test) != 0) printf("Tab is a space character\n");
else printf("Tab is not a space character\n");
/* Assign a non-space character to the variable */
test = 'T';
/* Test to see if this character is a space character */
if (isspace(test) != 0) printf("%c is a space character\n", test);
else printf("%c is not a space character\n", test);
return 0;
}
When compiled and run, this utility will output:
Tab is a space character
T is not a space character
Similar Functions
Other C functions that are similar to the isspace function:
iscntrl function isgraph function isprint feature
Leave a Review