【笔记】 C++中 Prefix/Suffix of a Literal

C++ Primer(English Version)Page40 Table 2.2 是需要记忆一下的。(有些记不住,就记了下笔记)

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

示例请见【C++ Primer(5th Edition) Exercise】练习程序 - Chapter2(第二章)Exercise 2.5 & 2.7。

猜你喜欢

转载自blog.csdn.net/weixin_50012998/article/details/108204816