Consider the C expression (x > 0) && (y++). If x is -1 and y is 5 before the expression is evaluated, what is the value of y immediately after?
B
Step-by-Step Solution
Key idea: Logical AND (&&) short-circuits if the left operand is false.
Step 1: Evaluate the left operand: x > 0. Since x = -1, this is false.
Step 2: Because the left operand is false, the entire && expression is false regardless of the right side.
Step 3: C short-circuits, meaning the right operand (y++) is never evaluated.
Step 4: y is not incremented and remains 5.
Answer: y remains 5.