What is the difference between call by value and call by reference in C?

C Programming Language >   Pointer in C Language >   Call by Reference in C  

Long Question

999


Answer:

Following are the differences between a call by value and call by reference are:

  Call by value Call by reference
Description When a copy of the value is passed to the function, then the original value is not modified. When a copy of the value is passed to the function, then the original value is modified.
Memory location Actual arguments and formal arguments are created in separate memory locations. Actual arguments and formal arguments are created in the same memory location.
Safety In this case, actual arguments remain safe as they cannot be modified. In this case, actual arguments are not reliable, as they are modified.
Arguments The copies of the actual arguments are passed to the formal arguments. The addresses of actual arguments are passed to their respective formal arguments.


This Particular section is dedicated to Question & Answer only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.




Join Our telegram group to ask Questions

Click below button to join our groups.