IBM Interview Question: Why would one use pass by ref... | Glassdoor

Find your next job here

Interview Question

Software Engineer Interview

Why would one use pass by reference instead of pass by


Interview Answer

3 Answers


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.

Interview Candidate on Jul 17, 2013

What was the project given to you ?

mriacle404 on Jul 3, 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.

Arvind on Oct 16, 2014

Add Answers or Comments

To comment on this, Sign In or Sign Up.