Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: updated for consistency with TS 17961

...

At compile time, string literals are used to create an array of static storage duration of sufficient length to contain the character sequence and a null-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 because string literals are typically stored in read-only memory. See also undefined behavior 33  of Annex J of the C standard [ISO/IEC 9899:2011].

The returned value of the library functions strpbrk(), strchr(), strrchr(), wcspbrk(), wcschr(), and wcsrchr() and pointer to (or array of) const characters shall be treated as a string literal.

Do not attempt to modify a string literal. Use a named array of characters to obtain a modifiable string.

...