From the course: C Programming: Exploring Advanced Concepts and Practical Applications

Unlock the full course today

Join today to access over 23,400 courses taught by industry experts.

Outputting wide characters

Outputting wide characters

- [Instructor] This code outputs four wide characters defined in the hello array. The data type is wide character wchart. The set locale function establishes my current locale, United States English. You can reset this locale to your own if you prefer. The for loop outputs each wide character. The putwchar function is the wide character version of the putchar function in the standard C Library. This same function outputs a new line here at line 15 using the standard new line escape sequence. And this is an adorable way to say hello. In this modification to the code, the hello array is transformed into a string. The new line is added here. The null terminator is added as the last character, which is what makes this array a string. Granted, this is an ugly way to construct a string, but it's necessary when you can't type the wide characters directly into the editor. The locale is set at line 10. The fputws function outputs the wide string to standard output. This is the wide character…

Contents