The post-increment operator i++ returns the current value of i and then increments it. So, fun(i) will return the current value of i (which is 1) and then increment i to 2.
In the main function:
cCopy code
int i = 1; i = fun(i); printf("%d", i);
Here, i is assigned the result of fun(i), which is 1. So, the program prints the value of i, which is 1.
Therefore, the correct answer is D. The program outputs 1.
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit