
- C Programming Tutorial
- C - Home
- C - Overview
- C - Environment Setup
- C - Program Structure
- C - Basic Syntax
- C - Data Types
- C - Variables
- C - Constants
- C - Storage Classes
- C - Operators
- C - Decision Making
- C - Loops
- C - Functions
- C - Scope Rules
- C - Arrays
- C - Pointers
- C - Strings
- C - Structures
- C - Unions
- C - Bit Fields
- C - Typedef
- C - Input & Output
- C - File I/O
- C - Preprocessors
- C - Header Files
- C - Type Casting
- C - Error Handling
- C - Recursion
- C - Variable Arguments
- C - Memory Management
- C - Command Line Arguments
- C Programming useful Resources
- C - Questions & Answers
- C - Quick Guide
- C - Useful Resources
- C - Discussion
isblank() in C/C++
The function isblank() is used to check that the passed character is blank or not. It is basically a space character and it also considers tab character(\t). This function is declared in “ctype.h” header file in C language and “cctype”” header file in C++ language.
Here is the syntax of isblank() in C++ language,
int isblank(int char);
Here is an example of isblank() in C++ language,
Example
#include <ctype.h> #include <iostream> using namespace std; int main() { string s = "The space between words. "; int i = 0; int count = 0; while(s[i]) { char c = s[i++]; if (isblank(c)) { count++; } } cout << "\nNumber of blanks in sentence : " << count << endl; return 0; }
Output
Number of blanks in sentence : 4
In the above program, a string is passed in variable s. The function isblank() is used to check the spaces or blanks in the passed string as shown in the following code snippet.
string s = "The space between words. "; int i = 0; int count = 0; while(s[i]) { char c = s[i++]; if (isblank(c)) { count++; } }
- Related Articles
- IntlChar::isblank() function in PHP
- isless() in C/C++
- islessgreater() in C/C++
- isgreater() in C/C++
- modf() in C/C++
- islessequal() in C/C++
- strxfrm() in C/C++
- Comments in C/C++
- isgreaterequal() in C/C++
- ungetc() in C/C++
- (limits.h) in C/C++
- Pointers in C/C++
- fseek() in C/C++
- strcpy() in C/C++
- strcmp() in C/C++

Advertisements