Q:

What do you mean by call by value and call by reference in c++?

0

What do you mean by call by value and call by reference?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Answer:

You can pass the value in function two ways call by value or call by reference. These two ways are generally differentiated by the type of values passed to them as parameters.

Call by value-: Values of actual parameters are copied to the function’s formal parameters and the two types of parameters are stored in different memory locations. So any changes made inside functions are not reflected in the actual parameters of the caller.

Call by reference-: Addresses of the actual arguments are copied and then assigned to the corresponding formal arguments. So in the call by reference both actual and formal parameters are pointing to the same memory location. Therefore, any changes made to the formal parameters will get reflected in the actual parameters.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C++ Interview Questions and Answers(2022)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
What is a namespace in c++?... >>
<< What is the difference between delete and free in ...