◐ Shell
clean mode source ↗

string literal - cppreference.com

Da cppreference.com.

Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.

La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui.

Click here for the English version of this page

<metanoindex/>

Sintassi

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

Spiegazione

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

Qualsiasi carattere valido

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 sequenze di escape

Tipo

# Il tipo di una stringa senza prefisso letterale è 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.

# Il tipo di una stringa letterale è 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.

Note

  • Letterali stringa possono essere concatenati

    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.

  • Il carattere NUL \ 0 viene sempre aggiunto alla stringa

    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.

  • Può essere usato per inizializzare array di caratteri

    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.

Esempio

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