A data type used to represent wide characters, typically supporting larger character sets such as Unicode. Its size is platform-dependent but is often 2 or 4 bytes.
1st Parameter
The wide character to be written to the standard output (`stdout`).
Read more about parameters of putwchar in parameters section
The putwcharfunction in C language Writes a wide character to the standard output stream.
The putwchar function writes a single wide character to the standard output stream (stdout). It's equivalent to putwc(wc, stdout). This function is particularly useful for outputting non-ASCII characters to the console in a locale-aware manner.
The putwcharfunction takes 1
parameter:
•
wchar_t `wc`: The wide character to be written to the standard output (`stdout`).
Writes the wide character `wc` to the standard output (`stdout`). Returns the character written as a `wint_t` on success or `WEOF` if an error occurs. The function is commonly used for wide-character output in locales supporting extended character sets.
The putwchar function return value :
Returns the wide character written as a wint_t value if successful, or WEOF if an error occurred
Output
This example demonstrates writing a wide character (an emoji) to stdout using putwchar. It includes proper locale setting and error checking.