6.3.3 isblank Function
Test for a space or tab character.
Include
<ctype.h>
Prototype
int isblank (int c);
Argument
c
- The character to test.
Return Value
Returns a non-zero integer value if the character is a space or tab character; otherwise, returns zero.
Remarks
A character is considered to be a white-space character if it is one of the
following: space (' '
) or horizontal tab ('\t'
).
Example
See the notes at the beginning of this chapter or section for
information on using printf()
or scanf()
(and other functions reading and writing the stdin
or
stdout
streams) in the example code.
#include <ctype.h>
#include <stdio.h>
int main(void)
{
int ch;
ch = '&';
if (isblank(ch))
printf("& is a white-space character\n");
else
printf("& is NOT a white-space character\n");
ch = '\t';
if (isblank(ch))
printf("A tab is a white-space character\n");
else
printf("A tab is NOT a white-space character\n");
}
Example Output
& is NOT a white-space character
A tab is a white-space character