◐ Shell
clean mode source ↗

string literal — cppreference.com

De cppreference.com

<metanoindex/>

Syntaxe

" (unescaped_character|escaped_character)* " (1)
L " (unescaped_character|escaped_character)* " (2)

Explication

; 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.

N'importe quel caractère valide

Original:

Any valid character

The 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.

see les séquences d'échappement

Type d'

# Le type d'une chaîne sans préfixe littéral est 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.

# Le type d'une chaîne littérale est 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.

Notes

  • Les littéraux de chaîne peuvent être concaténées

    Original:

    String literals can be concatenated

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • Le caractère NUL \ 0 est toujours ajouté à la chaîne

    Original:

    The NUL character \0 is always appended to the string

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

  • Peut être utilisé pour initialiser des tableaux de caractères

    Original:

    Can be used to initialize character arrays

    The text has been machine-translated via Google Translate.
    You can help to correct and verify the translation. Click here for instructions.

Exemple

char array[] = "Foo" "bar";
// same as
char array[] = { 'F', 'o', 'o', 'b', 'a', 'r', '\0' };