string 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. |
| 本节是不完整的 原因: C++11 stuff |
目录 |
[编辑] 语法
" (unescaped_character|escaped_character)* "
|
(1) | ||||||||
L " (unescaped_character|escaped_character)* "
|
(2) | ||||||||
[编辑] 解释
; unescaped_character
Original:
;unescaped_character
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:Any valid characterThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
; escaped_character
Original:
;escaped_character
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.
- see 转义序列
[编辑] 类型
#不带前缀的字符串文字的类型是const char*
Original:
# The type of an unprefixed string literal is const char*
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.
#L"..."字符串文字的类型是const wchar_t*
Original:
# The type of a L"..." string literal is const wchar_t*
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:String literals can be concatenatedThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - NUL字符\ 0总是附加到字符串中Original:The NUL character \0 is always appended to the stringThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - 可用于初始化字符数组Original:Can be used to initialize character arraysThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 为例
char array[] = "Foo" "bar"; // same as char array[] = { 'F', 'o', 'o', 'b', 'a', 'r', '\0' };

