wchar_t / Wide character Data Type

How is "wchar_t" datatype used in C++?.


The "wchar_t" data type is used to display wide characters that will occupy 16 bits. This datatype occupies "2 or 4" bytes. Mostly the wchar_t datatype is used when international languages like japanese are used.

Example :

#include <iostream.h>
void main()
wchar_t w;
w = L'A';
cout << "Wide character value::" << w << '\n';
cout << "Size of the wide char is::" << sizeof(w);


Wide character value::65
Size of the wide char is::2

In the above example the a wide character constant equivalent of 'A' is declared. The number of bytes occupied
"2" bytes.

C++ Tutorial

Ask Questions

Ask Question