The value of an element newtemps[i] in the interior of newtemps will depend upon oldtemps[i-1], oldtemps[i], and oldtemps[i+1] according to our formula for heat propagation.
Once we have completely calculated every entry of newtemps, we need to copy them into oldtemps in preparation for the next round of calculations.