On Thu, Sep 3, 2009 at 1:35 PM, Sandip Tujare<[email protected]> wrote:

> > int m=1;
> > m=m++ + m++ + ++m + ++m;

> Answer of this program is 14 because here order of evaluation of the 
> statement is right to left.

I rest my case. This is wrong.

"Order of evaluation" relates to the + signs, not the bits in-between
the + signs.

Specifically the ++ operators may be evaluated in any order (from
right to left for example, but not necessarily. Doing so would result
in 12.)

Adding parenthesis will not change this (to preempt the next answer...)


-- 
PJH

http://shabbleland.myminicity.com/
http://www.chavgangs.com/register.php?referer=9375
http://www.kongregate.com/?referrer=Shabble

Reply via email to