Hi all,

I wrote the following code n c++

and got the following output:Code:#include <stdio.h> #include <iostream> #include <conio.h> using namespace std; int main (){ int x,y; x=5; y=++x*++x; printf ("\ny=%d %d",y,x); x=5; y=x++*++x; printf ("\ny=%d %d", y,x); x=5; y=x++*x++; printf ("\ny=%d %d", y,x); cin.get(); return 0; }

49 7

36 7

25 7

going by the right to left operator associativity of the preincrement and the fact that the post increment effects take place after the expression is calculated the last two results are understandable.

But in the first result it can only be possible if the multiplication was 7*7. I think this should not be happening and the result must be 42 (7*6).

In fact when I ran the program for ++x*++x*++x , I got 392 (8*7*7) and so on for any more extensions.

Am I missing something here?

Any help would be appreciated