The standard wide character type in C and C++.

In C, wchar_t is a typedef-name for an integral type large enough to hold the widest character set the compiler supports.

In C++, std::wchar_t is a builtin type large enough to hold the widest character set the compiler supports.

The languages' respective standards place no other requirement this type. They may be exactly the same size as char, and, if the compiler chooses not to distinguish multibyte characters from traditional ASCII characters, may have the exact same set of values! In addition, the standards allow wchar_t to be wider than anything needed for the character set.

For most 32-bit C and C++ compilers, such as x86 gcc, wchar_t is implemented as a 16-bit type, closely resembling an unsigned short, enough to encode the Unicode (UCS-2) character set.

Log in or register to write something here or to contact authors.