GATE | GATE-CS-2002 | Question 18
The results returned by functions under value-result and reference parameter passing conventions
(A) Do not differ
(B) Differ in the presence of loops
(C) Differ in all cases
(D) May differ in the presence of exceptions
Explanation: The result is updated since the updated values are returned back to the original variable. In call by reference, any change in the variable reflects immediately.
A small example for call by reference and call by value is given below.
See question 5 of https://www.geeksforgeeks.org/principle-of-programming-languages-set-1/
This solution is contributed by Anil Saikrishna Devarasetty
Quiz of this Question