Originally posted by M Krishnan:
The explanations are not clear for me.
The very first time it enters the loop, tricky will be 0. Because of the post-increment operator, after the line tricky += tricky++, the value of tricky should be 1 before it enters the loop for the second time.
tricky++ translates to tricky = tricky + 1.
not sure why it is zero all the way. It acts as if tricky++ doesn't exist.
Basically, the post increment is done after the expression is evaluated, but *before* the assignment is made. So...
The value to be assigned is calculated to be zero (tricky + tricky). The value of tricky is incremented to one. And finally, the value of tricky is assign the value of the expression, which is zero.
Henry