In this, first d is incremented (because ++ has a higher priority than / or =), but c is divided by the unincremented value of d. Thus, the order of evaluation in this case is well-defined. But if we had written the above as:
then which operand ( c or d++ ) is evaluated first is undefined. Isn't this what Dennis Ritchie meant in his book when he said :"C, like most languages, does not specify the order in which the operands of an operator are evaluated." ?. In the first case, the order in which the operands of '/' are evaluated can be gauged, but not in the second case. Is my understanding correct ?
Secondly, in the ubiquitous problem :
everyone (including Dennis Ritchie for a[i]=i++) seems to say that the behaviour of this is undefined and depends on the compiler. But isn't it true that, since the post-increment operator has a higher priority than = , i++ will be evaluated first, but the unincremented value of i will be passed to i and i should remain unchanged after all that ? (though it gets incremented in Turbo C). My question is that why is its behaviour said to be undefined when the rules of priority seem to define its behaviour perfectly.
Its bugging me a lot. I shall be highly grateful.