isdigit() in C++

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

Parameters: One parameter is required for this function.

arg: Character to be checked.

Syntax:

isdigit(arg)

For Example:

isdigit('1') = > It returns true.

Approach

C++

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

int main()
{
    char ch = '1';

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

    return 0;
}


No comments:

Post a Comment