Versions Compared

Key

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

...

A better approach is to not specify the dimension of a string initialized with a string literal, as the compiler will automatically allocate sufficient space for the entire string literal, including the terminating null character.

Incidentally, initializing Initializing a character array using a string literal to fit exactly without a null byte is not allowed in C++.

This rule contrasts with is related to ARR02-A. Explicitly specify array dimensions, even if implicitly defined by an initializer.

...