isblank - C ctype.h

C examples for ctype.h:isblank

Type

function

From

<cctype> 
<ctype.h>

Description

Check if character is blank

Prototype

int isblank ( int c );

Parameters

Parameter Description
c Character to be checked, casted to an int, or EOF.

Return Value

A non zero value (i.e., true) if c is a blank character. Zero (i.e., false) otherwise.

Example

The following code prints out the C string character by character, replacing any blank character by a newline character.

Demo Code


#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;
}

Related Tutorials