ispunct() in C++

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

Parameters: One parameter is required for this function.

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

Syntax:

ispunct(arg)

For Example:

ispunct('!') = > It return true (any non-zero value).

Approach

C++

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

int main()
{

    char ch = '!';

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

    return 0;
}


No comments:

Post a Comment