Arrays use zero-based indexing. The first element is at index 0, not 1. For int data[5];, valid indices are 0, 1, 2, 3, 4. There is no data[5]. The index is an offset from the starting address.
Index 0 means zero steps from start. Index 1 means one step from start. An array of size N has indices 0 through N-1. If you have five elements, the last valid index is 4. Loops use i < size, not i <= size.