A string literal is a sequence of zero or more multibyte characters enclosed in double quotes ("xyz"
, for example). A wide string literal is the same, except prefixed by the letter 'L' (L"xyz"
, for example).
At compile time, string literals are used to create an array of static storage duration and of sufficient length to contain the character sequence and a NULLnull-termination character. It is unspecified whether these arrays are distinct. The behavior is undefined if a program attempts to modify string literals but frequently results in an access violation, as string literals are typically stored in read-only memory.
...
As an array initializer, a string literal specifies the initial values of characters in an array ( as well as the size of the array (see STR36-C. Do not specify the dimension of a character array initialized with a string literal). This code creates a copy of the string literal in the space allocated to the character array a
. The string stored in a
can be safely modified.
...