Answer to Question #20192 in C++ for natasha

Question #20192
,explain how pass by reference differs with pass by value method
1
Expert's answer
2012-12-07T03:57:46-0500

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS