for( A; B; C)
D;
It executes like: A,B,D,C,B,D,C,B,D...B.
i = 6, initially.
A would make i = 5.
B would make i = 4.
D will print 4.
C will make i = 3.
B will make i = 2.
D will print 2.
C will make i = 1.
D will make i = 0, then it will be checked (because pre decrement).
i = 0, so break out of the loop.
4 and 2 are printed.