In this article, we will discuss the working principle, syntax and examples of putwchar() function in C STL.
The putwchar() function is a built-in function in C STL, which is defined in the
This function is the wide character version of putchar(), which is defined in the
putwchar( wchar_t widec );
The function accepts the following parameters:
This function returns two values:
wchar_t ch = ‘a’; putwchar(ch);
a
Example demonstration
#include <bits/stdc++.h> using namespace std; int main(){ setlocale(LC_ALL, "en_US.UTF-8"); wchar_t hold = L'\u05d0', next = L'\u05ea'; wcout << L"Hebrew Alphabets are: "; for (wchar_t i = hold; i <= next; i++){ putwchar(i); putwchar(' '); } return 0; }
Hebrew Alphabets are: א ב ג ד ה ו ז ח ט י ך כ ל ם מ ן נ ס ע ף פ ץ צ ק ר ש ת
Example demonstration
#include <bits/stdc++.h> using namespace std; int main(){ wchar_t hold = 'a', next = 'b'; wcout << "English Alphabets are: "; for (wchar_t i = hold; i <= next; ++i){ putwchar(i); putwchar(' '); } return 0; }
English Alphabets are: a b
The above is the detailed content of In C/C++, the putwchar() function is a function used to output a wide character. For more information, please follow other related articles on the PHP Chinese website!