
- C Library - Home
- C Library - <assert.h>
- C Library - <complex.h>
- C Library - <ctype.h>
- C Library - <errno.h>
- C Library - <fenv.h>
- C Library - <float.h>
- C Library - <inttypes.h>
- C Library - <iso646.h>
- C Library - <limits.h>
- C Library - <locale.h>
- C Library - <math.h>
- C Library - <setjmp.h>
- C Library - <signal.h>
- C Library - <stdalign.h>
- C Library - <stdarg.h>
- C Library - <stdbool.h>
- C Library - <stddef.h>
- C Library - <stdio.h>
- C Library - <stdlib.h>
- C Library - <string.h>
- C Library - <tgmath.h>
- C Library - <time.h>
- C Library - <wctype.h>
- C Programming Resources
- C Programming - Tutorial
- C - Useful Resources
C Library - isblank() function
The C ctype library isblank() function is used to check whether a given character is a blank character or not. Blank characters typically include spaces and horizontal tabs.
Syntax
Following is the C library syntax of the isblank() function −
int isblank(int c);
Parameters
This function accepts a single parameter −
c − This is the character to be checked, passed as an int. It must be representable as an unsigned char or the value of EOF.
Return Value
The function returns a non-zero value (true) if the character is a blank character (space ' ' or horizontal tab '\t').It returns 0 (false) otherwise.
Example 1: Checking Space Character
Here we check if a space character (' ') is a blank character using isblank(), which returns true.
#include <stdio.h> #include <ctype.h> int main() { char ch = ' '; if (isblank(ch)) { printf("The character is a blank character.\n"); } else { printf("The character is not a blank character.\n"); } return 0; }
Output
The above code produces following result−
The character is a blank character.
Example 2: Checking Non-Blank Character
#include <stdio.h> #include <ctype.h> int main() { char ch = 'A'; if (isblank(ch)) { printf("The character is a blank character.\n"); } else { printf("The character is not a blank character.\n"); } return 0; }
Output
After execution of above code, we get the following result −
The character is not a blank character.
Advertisements