To visit every array element, use a for loop with an index variable. Start at 0, continue while the index is less than the size, increment by 1 each iteration. This pattern appears constantly in C++ code.
The loop body accesses arr[i] to read or modify the current element. Since i changes each iteration, you visit every element from first to last. Print, sum, or modify them as needed.
Watch your bounds. Valid indices run from 0 to size-1. For 5 elements, indices are 0 through 4. Your condition must be i < 5, not i <= 5. Off-by-one errors cause crashes.