Multiple choice technology programming languages

What is the output of the following C program? main() { int i=4,j=7; j = j || i++ && printf("YOU CAN"); printf("%d %d", i, j); }

  1. 5 7

  2. 4 7

  3. 5 1

  4. 4 1

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Due to the short-circuiting behavior of the logical OR (||) operator, the right-hand side i++ && printf(...) is never evaluated because the left operand j (7) is true. As a result, i remains 4, and the expression result of 1 is assigned to j.