Home   |   About   |   Terms   |   Contact    
Read & Learn
 

What is char16_t and char32_t in C++?

C++

☯ All C++ Articles     ☯ All Articles


A new product.




Popular Google Pages:



◕ This article is regarding What is char16_t and char32_t in C++?
Last updated on: .



◕ What is char16_t and char32_t in C++?

As C++ experience more with Unicode, it became clear that the wchar_t type wasn’t enough for describing character sets.
It finds out that encoding characters and strings of characters on a computer system is more complex than just using the Unicode numeric values which is called code points.
Because the sign and size of wchar_t can vary from one implementation to another.
As a result C++ introduces the types
char16_t and
char32_t.




◕ char16_t is unsigned, 16 bits.
C++ uses the u prefix for char16_t character and string constants.

Example with coading are given bellow:
char16_t bird = u'B'; // character constant in 16-bit form
char16_t bud = u" A beautiful bird "; // string constant in 16-bit form



◕ char32_t is unsigned, 32 bits.
C++ uses the U prefix for char32_t character and string constants.

Example with coading are given bellow:
char32_t bird = U'B'; // character constant in 32-bit form
char32_t bud = U" A beautiful bird "; // string constant in 32-bit form



Related articles:
What is wchar_t in C++?
Integer Type in C++
Rules for Variable Names
Variable in C++
Fundamental Data Types & Compound Data Types
What is called Directive and Header File in C++ ?
What is Block Statement in C++ ?




Popular Google Pages:



Top of the page

Amazon & Flipkart Special Products

   


Top of the page