iswspace() function in C/C++
Last Updated :
21 Dec, 2022
The iswspace() is a built-in function in C/C++ which checks if the given wide character is a wide whitespace character or not. It is defined within the cwctype header file of C++. Syntax:
int iswspace(ch)
Parameters: The function accepts a single mandatory parameter ch which specifies the wide character which is to be checked for a wide whitespace character or not. Return Value: The function returns two values as shown below.
- It returns a non-zero value if the parameter ch, is a wide whitespace.
- It returns 0 if it is not a lowercase character.
Below programs illustrates the above function. Program 1:
CPP
#include <cwctype>
#include <iostream>
using namespace std;
int main()
{
wchar_t c;
int i = 0;
wchar_t str[] = L"Geeks For Geeks\n";
while (str[i]) {
c = str[i];
if (iswspace(c))
c = L '\n' ;
putwchar(c);
i++;
}
return 0;
}
|
Program 2:
CPP
#include <cwctype>
#include <iostream>
using namespace std;
int main()
{
wchar_t c;
int i = 0;
wchar_t str[] = L"Hello Ishwar Gupta\n";
while (str[i]) {
c = str[i];
if (iswspace(c))
c = L '\n' ;
putwchar(c);
i++;
}
return 0;
}
|
Output:
Hello
Ishwar
Gupta
Share your thoughts in the comments
Please Login to comment...