English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C / C ++isblank() in

The functionisblank()It is used to check if the passed character is a blank. It is basically a space character and also considers tab characters (\t). This function is declared in the "ctype.h" header file of C ++declared in the "cctype" header file of the language.

This isisblank()C ++language syntax,

int isblank(int char);

This isisblank()C ++language example,

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 result

Number of blanks in sentence : 4

In the above program, a string is passed in the variable s. This functionisblank()This is used to check for spaces or blank spaces 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++;
   {}
{}