Answer to Question #20192 in C++ for natasha

Question #20192
,explain how pass by reference differs with pass by value method
Expert's answer

Pass By Reference :
In Pass by reference address of the variable is passed to a function. Whatever
changes made to the formal parameter will affect to the actual parameters
- Same memory location is used for both variables.(Formal and Actual)-
- it is useful when you required to return more then 1 values
Pass By Value:
- In this method value of the variable is passed. Changes made to formal will
not affect the actual parameters.
- Different memory locations will be created for both variables.
- Here there will be temporary variable created in the function stack which
does not affect the original variable.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

New on Blog