So in c++ why are these 2 outputs different?
int x;
for(int x=2;x<5;x++);
cout<<x<< x++ << ++x << x <<endl;
this out outputs 7677
cout<<x<<endl;
cout<<x++<<endl;
cout<<++x<<endl;
cout<<x<<endl;
this out outputs 5577
so why are they different?
what i guessed is the first one computes the entire line at the same time that's why it outputs 7 but then why would ++x
still output 6? is there some kind of priority here or what is going on?