
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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++; } }
Advertisements