posted 21 years ago
Let's look at part 1. The t & ((i++) == 0) part.
& is a binary "and" operator being used on t, on the left; and ((i++) == 0) on the right. t has the value true. Let's find out the value of the righthand side.
Notice the i++. That's a postfix ++ operator.
That means you have to use the value of i before it is incremented. That value is 0. So the righthand side is the result of 0 == 0, that is true.
So the result of part 1: true & true is assigned to b. Now true & true results in true. Any other combination is false.
But there is something else that happens, a side-effect. The side-effect is that i becomes 1.
After the part 1 the value of i is 1. We do not care about the value of b.
The important thing to see is that both sides of the & operator had to be evaluated.
If you can follow all that and understand it, then try part 2 yourself.
-Barry
[ August 16, 2002: Message edited by: Barry Gaunt ]