Please explain why the answer is 1 and not 0.
Int x = 0; int y = 0;
if(++x > 4 && ++y > 2)
I understand that ++x would increment 0 to 1, and ++y would increment 0 to 1, but 1 is not greater than 4 and 1 is not greater than 2, so the statement x++ would be skipped, and x should still be 0. Why is the correct answer 1?
Joshua Stamps , the if clause is false , because the first part of the expression is false (that's why the second part is not evaluated and y is not incremented) => 1 > 4 is false (but x is becoming 1 - preincrement operation => ++x). So it prints 1 🐱