Save last and penultimate value in array

Dear Community

I have an acceleration sensor which gives me the actual acceleration values. I want to save the last value and the penultimate value in an array so that I can calculate the difference of the two values. Can someone tell me how I can save the penultimate value in an array.

Continually overwrite the current penultimate one with the current ultimate one, and then write the new one in as current ultimate one.

Might actually be just easier to have a couple of variable.

penUltimate = ultimate;
ultimate =readTheSensor();