michael_x:
for (int n = 0; n <= 3; n++)
should rather read
for (int n = 0; n < 3; n++)
Yes that for condition should be changed, to correct it for the size of the array. Your arrays are size 3 but including the equals sign will cause the loop to run 4 times.
michael_x:
OLDvalues1[3] is a different variable and not part of your OLDvalues1[] array
What do you mean? OLDvalues1[3] doesnt exist, it's out of the range of the array.