string literal

From Cppreference

Jump to: navigation, search

Contents

[edit] Syntax

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

[edit] Explanation

unescaped_character
Any valid character
escaped_character
see escape sequences

[edit] Type

  1. The type of an unprefixed string literal is const char*
  2. The type of a L"..." string literal is const wchar_t*

[edit] Notes

[edit] Example

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