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
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Check whether count of odd and even factors of a number are equal
- Difference between C and Dart
- History of Computer Games
- Difference between Sentinel and Counter Controlled Loop in C
- Why do we need reference variables if we have pointers
- What are the differences between C and Embedded C?
- Similarities and Difference between Java and C++
- Macros and its types in C/C++
- How to find index of a given element in a Vector in C++
- Difference between MS SQL Server and IBM DB2
- Introduction of MariaDB
- Introduction to Complex Objects and Composition
- Draw a smiley face using Graphics in C language
- NULL undeclared error in C/C++ and how to resolve it
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.