Q35
What will be the value of i and j after execution of following program? #include void main() int i, j; for(i=0,j=0;i<10,j<20;i++,j++) printf("i=%d %t j=%d", i, j);
A.
10 10
B.
10 20
C.
20 20
AnswerD.
Run time error
Answer: Option C
Solution
Answer: Option C
Solution:
comma operator is executed from left to right so until j<20 for loop statement is true, so both i and j are incremented.
So, i = 20 and j = 20.