Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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
bgColor#FFcccc
langc
#include <stdio.h>
 
void func(void) {
  char c_str[3] = "abc";
  printf("%s\n", c_str);
}

...