Call by Value VS Call by Reference.. Which is better?
(i) Call by Value passes a copy of the original argument to the function and if any modifications is made on these arguments then it will not be reflected on the actual variable.
(ii) In Call by Reference, the memory address of the variables are passed so if any changes is made, the actual value stored at that memory location will also change.
According to me both are better as both have their own purposes. If we want to perform an operation on a variable without modifying the value of original, then Call by Value is preferred. If we want to perform an operation on variable and at the same time we want to update the original value then Call by Reference is preferred.