The isblank()function returns non-zero if ch is a character for which isspace() returns true and is used to separate words. Thus for English, the blank characters are space and horizontal tab.
Header File : ctype.h Declaration : int isblank(int ch)
difference between isblank() and isspace()
The isspace() simply return true if the character is a space. In other words blank character is a space character used to separate words within a line of text and isblank() is used to identify it.
isblank() considers blank characters the tab character (‘\t’) and the space character (‘ ‘).
isspace() considers space characters : (‘ ‘) – Space, (‘\t’) – Horizontal tab, (‘\n’) – Newline, (‘\v’) – Vertical tab, (‘\f’) – Feed, (‘\r’) – Carriage return
Input: Geeks for Geeks Output: Geeks for Geeks
Explanation: Since there are 2 spaces for Geeks for Geeks marked by an underscore( _ ) :
we replace the space with a newline character.
isblank() C++ Program:
This code prints out the string character by character, replacing any blank character by a newline.
Geeks for Geeks Total blanks are : 2
- isspace() in C/C++ and its application to count whitespace characters
- std::string::insert() in C++
- rand() and srand() in C/C++
- Sort in C++ Standard Template Library (STL)
- C++ | Nested Ternary Operator
- Working of Keyword long in C programming
- Code valid in both C and C++ but produce different output
- Different ways to Initialize all members of an array to the same value in C
- Why does sizeof(x++) not increment x in C?
- C program to find the length of a string
- C Program to Multiply two Floating Point Numbers
- C Program to Compute Quotient and Remainder
- C program to Find the Largest Number Among Three Numbers
- C program to find the size of int, float, double and char
- C program to Check Whether a Number is Positive or Negative or Zero
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.