int t, a = 5, b = 10, c = 15;
In C (and C ++), the comma operator evaluates its first operand, discards it and evaluates its second operand and returns it.
++a && ++b first evaluated, and now 6, b is now 11.
(++a && ++b, ++a) now the second operand is calculated to the right of the comma ( ++a ), and now 7. Also at this point t is assigned the value 7. This is because the assignment operator has a higher priority than the comma operator .
(++ a & ++ b, ++ a), ++ a now the second operand to the right of (++ a && ++ b, ++ a) is evaluated. The third is evaluated. The third ++ a` gives a value of 8.
Logical operator || evaluates its first operand, and if it is true , it does not evaluate the second operand. The first operand (++a && ++b, ++a), ++a is nonzero (true), and therefore ++ c is not evaluated. c stays at 15.
source share