C++ char32_t Keyword
Example
Store a 32-bit character and print its number:
char32_t myLetter = U'B';
cout << static_cast<int>(myLetter);
Definition and Usage
The char32_t keyword is a data type that stores a 32-bit character. It is used for UTF-32 text (a way to store each character from all languages as one 32-bit number).
Write a char32_t value with a capital U in front, like U'B'.
cout cannot print a char32_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 66 for B.
Related Pages
Read more about characters in our C++ Character Data Types Tutorial.