VOOZH about

URL: https://www.geeksforgeeks.org/cpp/isblank-in-cc/

⇱ isblank() in C/C++ - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

isblank() in C/C++

Last Updated : 26 Apr, 2018
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 Examples:
Input: Geeks for Geeks
Output: Geeks
 for 
 Geeks
Explanation: Since there are 2 spaces for Geeks for Geeks marked by an underscore( _ ) : Geeks_for_Geeks 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. Output:
Geeks
for
Geeks
Total blanks are : 2
Comment
Article Tags:
Article Tags: