CodeTheRobot

C++ Advanced · exercise 06

Sanitizers & bounds discipline

Fix an off-by-one loop that a sanitizer would flag as a buffer overrun.

C++ Advanced lesson 06

Guided steps

  1. 1.The loop currently reads one element past the end of the array.
  2. 2.Fix the bound so exactly four elements are summed.
  3. 3.Print the size and the sum.

Your code

Your code is saved in this browser after every run and restored next time.