The program outputs 3 because the fun function returns the value of --n, which is a post-increment operator. This means that the value of n is decremented by 1 before it is returned. Therefore, fun() returns 3, which is the original value of n before decrementing. The main function calls fun() twice and adds the results, which gives 3 + 3 = 6. Then, the main function prints the result with a %d format specifier, which shows the integer part of the result. Therefore, the output of the program is:
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