What is the difference between
wchar_t arry[]
and
char arry[]
type initialization.
For Unicode I know character I know it has several format of encoding. In which windows use UTF-16. Which means most characters are 16 bit. But in char type one character is 8bit. Does that means we can store 2byte in wchar type?
Which type is more efficient? Why?
Both are variable-length on Windows (where wchar_t implies UTF-16) and the later is wasteful for most test out there. Even in CJK half the text transferred through the net is ASCII.
The most portable and easiest way to support Unicode is to use UTF-8 (char). It implies small performance penalty when converting to UTF-16 in order to pass the strings to the Windows API, but it’s relatively minor compared to the system calls.