...
This code example is noncompliant because the character sequence c_str
will not be null-terminated when passed as an argument to printf().
(see See STR11-C. Do not specify the bound of a character array initialized with a string literal on how to properly initialize character arrays.).
Code Block | ||||
---|---|---|---|---|
| ||||
#include <stdio.h> void func(void) { char c_str[3] = "abc"; printf("%s\n", c_str); } |
...