C examples for ctype.h:isblank
function
<cctype> <ctype.h>
Check if character is blank
int isblank ( int c );
Parameter | Description |
---|---|
c | Character to be checked, casted to an int, or EOF. |
A non zero value (i.e., true) if c is a blank character. Zero (i.e., false) otherwise.
The following code prints out the C string character by character, replacing any blank character by a newline character.
#include <stdio.h> #include <ctype.h> int main ()/* ww w . j ava 2 s. c o m*/ { char c; int i=0; char str[]="this is a test. Example \tsentence \nto test isblank\n"; while (str[i]) { c=str[i]; if (isblank(c)) c='\n'; putchar (c); i++; } return 0; }