Google News
logo
Embedded C - Interview Questions
What is the difference between pass by value by reference in c and pass by reference in c?
Pass By Value:
 
* In this method, the 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 a temporary variable created in the function stack which does not affect the original variable.

Pass By Reference :
 
* In Pass by reference, an address of the variable is passed to a function.
* Whatever changes made to the formal parameter will affect the value of actual parameters(a variable whose address is passed).
* Both formal and actual parameters shared the same memory location.
* it is useful when you required to returns more than 1 value.
Advertisement