isblank() — Test for Blank or Tab Character

Format

#include <ctype.h>
int isblank(int c);

Note:
The isblank() function is supported only for C++, not for C.

Language Level: Extended

Threadsafe: Yes.

Description

The isblank() function tests if a character is either the EBCDIC space or EBCDIC tab character.

Return Value

The isblank() function returns nonzero if c is either the EBCDIC space character or the EBCDIC tab character, otherwise it returns 0.

Example that uses isblank()

This example tests several characters using isblank().

#include <stdio.h>
#include <ctype.h>

int main(void)
{
   char *buf = "a b\tc";
   int i;

   for (i = 0; i < 5; i++) {
     if (isblank(buf[i]))
        printf("Character %d is not a blank.\n", i);
      else
        printf("Character %d is a blank\n", i);
   }
   return 0;
}

/*************************************
     The output should be

 Character 0 is not a blank.
 Character 1 is a blank.
 Character 2 is not a blank.
 Character 3 is a blank.
 Character 4 is not a blank.

*************************************/

Related Information



[ Top of Page | Previous Page | Next Page | Contents | Index ]