Today I was learning some C++ basics and came to know about wchar_t
. I was not able to figure out, why do we actually need this datatype, and how do I use it?
wchar_t
is used when you need to store characters with codes greater than 255 (it has a greater value than char
can store).
char
can take 256 different values which corresponds to entries in the ISO Latin tables. On the other hand, wide char can take more than 65536 values which corresponds to Unicode values. It is a recent international standard which allows the encoding of characters for virtually all languages and commonly used symbols.