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