@airplane603 wrote:
I need to subtract the most recent element from my array from the element before it in order to find the difference between the two. Could someone help me?
There are diffeernt possible ways how to achieve this. If you have zero as last, then may be index of the array was wrong. Remember, that for array with 100 element the last one has index 99, not 100. In the cycle you can perform subtraction with help of shift register.
Short code snippet for you, may be will be helpful for understanding:
And result: