Home / Questions / What is the difference between call by value and call by reference in C?
Explanatory Question

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

👁 1,076 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation

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.