What's happening here?
#include <iostream>
using namespace std;
int main(){
int x=0,y=0;
true? ++x, ++y : --x, --y;
cout << "x: " << x << endl;
cout << "y: " << y << endl; //why does y=0 here?
x=0,y=0;
false ? ++x, ++y : --x, --y;
cout << "x: " << x << endl;
cout << "y: " << y << endl;
}
x: 1
y: 0
x: -1
y: -1
The second case seems fine. I would expect both x and y to increment to 1 in the first case but only the left hand operand increments.