- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
iswblank() function in C/C++
The function iswblank() is used to check that the passed wide 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 iswblank(wint_t char);
Here is an example of iswblank() in C++ language,
Example
#include <ctype.h> #include <iostream> using namespace std; int main() { wchar_t s[] = L"The space between words."; int i = 0; int count = 0; while(s[i]) { char c = s[i++]; if (iswblank(c)) { count++; } } cout << "\nNumber of blanks in sentence : " << count << endl; return 0; }
Output
Number of blanks in sentence : 5
In the above program, a string is passed in variable s. The function iswblank() is used to check the spaces or blanks in the passed string as shown in the following code snippet.
wchar_t s[] = L"The space between words."; int i = 0; int count = 0; while(s[i]) { char c = s[i++]; if (iswblank(c)) { count++; } }
Advertisements