Sample code for passing and returning an integer value from a method in C program:
What will be the output of this below program?
int i = 10;
i = fun(i);
int fun(int i)
i = i+10;
compile time error
This is an example of function returning the value. Even though both the i's are different, since the function fun() returns new value to i, the output will be 20, 21. function fun() what ever the value it is changing it is returning to main function.
Back To Top