C++ cctype isblank() Function
Example
Check if a space, a tab and a newline are blank characters:
cout << (isblank(' ') ? "Yes" : "No") << "\n";
cout << (isblank('\t') ? "Yes" : "No") << "\n";
cout << (isblank('\n') ? "Yes" : "No");
Definition and Usage
The isblank() function checks if a character is a blank character. The blank characters are the space ' ' and the tab '\t'.
It returns a non-zero number (true) if it is, and 0 (false) if it is not. A newline '\n' is not a blank character.
The isblank function is defined in the <cctype> header file.
Tip: Use isspace() to check for all whitespace characters, including newlines.
Syntax
int isblank(int c);
Parameter Values
| Parameter | Description |
|---|---|
| c | Required. The character to check. |
Technical Details
| Returns: | An int value. Non-zero (true) if the character is a space or a tab, otherwise 0 (false). |
|---|
Related Pages
Read more about strings in our Strings Tutorial.