Predict the output of the below C program:
(D) Compilation Error
Explanation: We know that printf() returns the number of character it prints. Hence printf(“%d”,j) will return -2 and newline i.e. 3 characters, and printf(“%d”, i) wil return 2 and newline i.e. 2. Thus if statement will look like (3 > 2) which is false. So the else block is executed followed by the execution of printf() statements within the if condition.
Quiz of this Question
Please comment below if you find anything wrong in the above post