isspace() in C++

isspace(): This function is available in the file ctype.h. This function checks whether a given character is a white space character or not. This function returns a value different from zero (i.e. true) if c is a white-space character. Zero (i.e. false) otherwise.

White spaces are:

' ', '\n', '\v','\t', '\f', '\r'

Parameters: One parameter is required for this function.

arg: The character to be checked, cast into an int.

Syntax:

isspace(arg)

For Example:

isspace(' ') = > It returns true.

Approach

C++

#include <bits/stdc++.h>
using namespace std;

int main()
{
    char ch = ' ';

    cout << isspace(ch<< "\n";

    return 0;
}


No comments:

Post a Comment