Passing by value actually passes a copy of an argument.
Passing by reference actually passes the address of an argument.
So the differences is:
1) when passing by value an argument always remains unchanged, when by reference can be changed;
2) if an argument is class or structure, then for passing by value a copy constructor is necessary (direct or indirect);
3) If an argument is large (structure) then passing by value requires more memory.
15 Million Students Helped!
Sign up to view the full answer