...
Do not attempt to modify a string literal. Use a named array of characters to obtain a modifiable string.
...
Noncompliant Code Example
In this non-compliant noncompliant code example, the char pointer p is initialized to the address of a string literal. Attempting to modify the string literal results in undefined behavior.
...
| Code Block | ||
|---|---|---|
| ||
char a[] = "string literal"; a[0] = 'S'; |
...
Noncompliant Code Example
In this non-compliant noncompliant example, the mktemp() function modifies its string argument.
...