Versions Compared

Key

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

When performing pointer arithmetic, the size of the value to add to a pointer is automatically scaled to the size of the pointer's type. For instance, when adding a value to a pointer to a four-byte integer, the value will be scaled by a factor of four . Improper use of and then added to the pointer. Failing to understand how pointer arithmetic works can lead to miscalculations that result in unintended program behaviorserious errors, such as buffer overflows.

Non-Compliant Code Example

...