IBM Interview Question

Why would one use pass by reference instead of pass by value?

Interview Answers

Anonymous

Jul 17, 2013

Passing by reference allows a function to manipulate multiple arguments beyond the local scope, which can be useful when the function needs to return or modify multiple elements.

Anonymous

Jul 3, 2014

What was the project given to you ?

Anonymous

Oct 16, 2014

In the case that you pass objects, using call by value can be expensive as a bit-wise-copy constructor is created. Passing by reference is also memory efficient.