Originally posted by Zac Roberts:
OK here it is:
This is a little tricky... the answer is:
30 20 30
Any good explanations? Is this exam likely to try one like this?
Thanks
Zac
Simply put, the trick is in the following line:
The first thing that is done when this line is executed is that each of the operands are evaluated. This is done in a left to right manner. Therefore iA[i], then i is evaluated, and then 30 is evaluated. Of course, there isn't much evaluating to do in order to evaluate 30.
Now, once all of the operands have been evaluated, the assignments take place (from right to left). 30 is assigned to i and the return value (30) is then assigned to iA[i], which was evaluated prior to the assignment to i, so this is really iA[0].
Hence, the correct answer is 30 20 30.
Corey