# **[](https://en.cppreference.com/w/c/header/wchar)** provides wide-character functions (C95): `wprintf`, `wcslen`, `wcscmp`, etc. The encoding of `wchar_t` is platform-dependent (UTF-32 on Linux, UTF-16 on Windows), making portable Unicode code difficult. For portable Unicode, prefer `` with `char32_t` (UTF-32) or `char16_t` (UTF-16). ## Example This example demonstrates wide-string handling and locale-aware output. ```c // compile: gcc -o wcharexample wcharexample.c // run: ./wcharexample // description: wide string handling and character counting #include #include #include #include int main() { setlocale(LC_ALL, ""); const wchar_t* ws = L"héllo"; const char* ns = "héllo"; wprintf(L"wide string: %ls\n", ws); wprintf(L"wcslen: %zu (wchar units)\n", wcslen(ws)); printf("strlen: %zu (bytes)\n", strlen(ns)); printf("sizeof(wchar_t): %zu\n", sizeof(wchar_t)); return 0; } ```