Test for a space or tab character.
Include
<ctype.h>
Prototype
int isblank (int c);
Argument
c
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
#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