So lets say you have 0, 1, 3, 9, 0, 4
Following your code you get 1,3,9,4,0,4 then the second loop clears it. Not bad. I like it and it is very efficient, even more so than mine I think and not just because of the pointers, which not every language takes advantage of.