Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Identify undefined behavior

...

In this noncompliant code example, the char pointer str is initialized to the address of a string literal. Attempting to modify the string literal is undefined behavior 32:

Code Block
bgColor#FFcccc
langc
char *str  = "string literal";
str[0] = 'S';

...