isspace()

Prototype: int isspace(int ch);
Header File: ctype.h (C) or cctype (C++)
Explanation: Isspace does exactly what is sounds like, checks if the ASCII value passed in is that of a space key (such as tab, space, newline, etc). It returns non-zero for true, and zero for false.



//Example reads in a character and checks if it is a type of space
#include <iostream>
#include <cctype>

using namespace std;

int main()
{
    char x;
    cin>>x;
    if(isspace(x))
    {
        cout<<"It's a space";
    }
    else
    {
        cout<<"It's not a space;  
    }
}
Other Functions