C++ char16_t Keyword
Example
Store a 16-bit character and print its number:
char16_t myLetter = u'A';
cout << static_cast<int>(myLetter);
Definition and Usage
The char16_t keyword is a data type that stores a 16-bit character. It is used for UTF-16 text (a way to store characters from all languages as 16-bit numbers).
Write a char16_t value with a u in front, like u'A'.
cout cannot print a char16_t as a character, and newer versions of C++ do not allow it at all. So change it to an int first. This prints the number of the character, which is 65 for A.
Related Pages
Read more about characters in our C++ Character Data Types Tutorial.