[Notes] Prefix/Suffix of a Literal in C++

C++ Primer (English Version) Page40 Table 2.2 needs to be memorized. (Some can't remember, so I took notes)

Character and Character String Literals

Prefix Meaning / Type
u Unicode 16 character / char16_t
U Unicode 32 character / char32_t
L wide character / wchar_t
u8 utf-8 (string literals only) / char

Integer Literals

Suffix Minimum Type
u or U unsigned
l or L long
ll or LL long long

Floating-Point Literals

Suffix Type
f or F float
l or L long double

For examples, please see [C++ Primer(5th Edition) Exercise] Exercise Program-Chapter2 Exercise 2.5 & 2.7.

Guess you like

Origin blog.csdn.net/weixin_50012998/article/details/108204816