iscntrl() in C++

iscntrl(): This function is available in the file ctype.h. This function checks whether a character is a control character or not. A control character is a character that does not occupy a printing position on the display.

Parameters: One parameter is required for this function.

arg: Character to be checked.

Syntax:

iscntrl(arg)

Approach

C++

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

int main()
{

    char ch[] = "Hello world \n Ram";

    for (int i = 0; !iscntrl(ch[i]); i++)
    {
        cout << ch[i];
    }

    return 0;
}

Output:

Hello world 


No comments:

Post a Comment