Question:

What is the output of the following program?
#include int main() 
{ int fun(int); int i = fun(10); printf("%d\n", --i); 
return 0; } int fun(int i) 
{ return (i++); } 

Show Hint

Post-increment returns original value before increasing it. Use pre/post carefully in return statements.
Updated On: June 02, 2025
  • 9
  • 10
  • 11
  • 8
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

In fun(10), the value returned is 10 because \(i++\) returns the current value before incrementing. So \(i = 10\), and then --i = 9 is printed.
Was this answer helpful?
0
0

Top Questions on Programming and Data Structures

View More Questions

TS PGECET Notification