C isblank function checks if a character is a blank or not
Syntax
C isblank
function has the following syntax.
int isblank(int ch);
Header
C isblank
function is from header file ctype.h
.
Description
C isblank
function returns nonzero if ch
is blank.
By default, the blank characters are space and horizontal tab.
Example
The following code uses C isblank
function to check
if a character is a blank character. It reads the character by
using the function getchar()
;
#include <ctype.h>
#include <stdio.h>
/* ww w . j ava 2 s . c o m*/
int main(void)
{
char ch;
for(;;) {
ch = getchar();
if(ch == '.') {
break;
}
if(isblank(ch)){
printf("%c is a word separator\n", ch);
}
}
return 0;
}
The code above generates the following result.