|
|
wchar_t / Wide character Data Type
|
Tutorials

Cpp

|
Topic |
How is "wchar_t" datatype used in C++?.
|
|
Explanation |
|
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);
}
|
Result:
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.
|
| Note |
C++ is one of the most used programming languages in the world. Also known as "C with Classes".
Hope you enjoy this tutorial. Do send your feedback or suggestions on this C++ tutorial. This is a copyright content.
|
|
|
|