Difference between call by value and call by reference
Answers
Answered by
5
call by value and call by references both passing arguments. in call by value, a copy actual arguments passed to respective formal arguments, the call by references location or address of the actual arguments
Answered by
8
Call by value:
1. In this Actual copy of arguments is passed to formal arguments.
2. Both the actual and formal arguments will be created in different memory locations.
3.Original value is not modified.
4. It works locally.
Call by reference:
1. In this Address(or)location of the actual arguments is passed.
2.Both the actual and formal arguments will be created in the same location.
3.Original value is modified.
4. It works globally.
Hope this helps!
1. In this Actual copy of arguments is passed to formal arguments.
2. Both the actual and formal arguments will be created in different memory locations.
3.Original value is not modified.
4. It works locally.
Call by reference:
1. In this Address(or)location of the actual arguments is passed.
2.Both the actual and formal arguments will be created in the same location.
3.Original value is modified.
4. It works globally.
Hope this helps!
Similar questions