Either create a new array or, as I have done with this particular problem, save previous state information in your arrary as well (an array of structs).