integer literal
来自cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
目录 |
[编辑] 语法
| [0-9]+ type_suffix | (1) | ||||||||
| 0 [0-7]+ type_suffix | (2) | ||||||||
| 0 x [0-9a-b]+ type_suffix | (3) | ||||||||
[编辑] 解释
#十进制记数法
Original:
# Decimal notation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
#八进制表示法
Original:
# Octal notation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
#十六进制记数法
Original:
# Hexadecimal notation
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 类型的后缀
(没有后缀)
Original:
;(no suffix)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- int
- u
- unsigned int
- l
- long
- ul
- unsigned long
- ll (C++11 起)
- long long
- ull (C++11 起)
- unsigned long long
[编辑] 注释
- 在整数常量的字母不区分大小写的Original:Letters in integer constants are case-insensitive.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 为例
std::cout << 123 << '\n' << 0123 << '\n' << 0x123 << '\n' << 12345678901234567890UL << '\n' << -1u << '\n' << -1ull << '\n';
Output:
123 83 291 12345678901234567890 4294967295 18446744073709551615
(从一个x86_64的处理器的输出)
Original:
(output from an x86_64 processor)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.

