,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.
Comments
Leave a comment