I was reading through K&R and i came across this example about uncertainty in behavior while evaluating expression like a[i]=i++
;
The C99 spec in $6.5.2 says that
Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be read only to determine the value to be stored.
The above example from K&R holds good on the first statement. Please explain how does it fail on the second.
Does standard says anything about the order of evaluation of sub-expressions in case of the sequence points being involved. Eg. a[i++] || b[i++]
. I know that these are evaluated from left to right but how can this be derived from the above statement or is it explicitly stated in the standard somewhere ?