If int x=5;
I suppose the expression y=++x * ++x;
is evaluated as:
First execute ++x
causing x=6
and then again ++x
causing x=7
the expression then evaluates y=x*x
making the value of y=49
Using same reasoning the following lines of code
int z=5, x=5,y=0,p=0;
y=++x * ++x + ++x;
p= ++z + ++z * ++z;
should have evaluated same values of y
and p
but the compiler produces different answer. I probably there is something I am missing in the order of precedence.