What do you mean by call by value and call by reference?
Answer Posted / glibwaresoftsolutions
A common topic that often appears in C++ interview questions is the difference between call by value and call by reference.
• Call by Value in C++: In the call-by-value method, function arguments are passed by copying the value of the actual parameter.
• This ensures that the original values remain unchanged since a separate copy of the value is created for the function's parameters.
• Call by Reference in C++: In the call-by-reference method, the memory address (or reference) of the actual parameter is passed to the function.
• This allows direct access to and modification of the original values.
• Both the actual and formal parameters refer to the same memory address, so any changes made to the parameters within the function are directly reflected in the original values outside the function.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Why is c++ still best?
What are advantages of c++?
What are compilers in c++?
What is the use of default constructor?
What are the three forms of cin.get() and what are their differences?
How would you use qsort() function to sort an array of structures?
What are member functions used in c++?
. If employee B is the boss of A and C is the boss of B and D is the boss of C and E is the boss of D. Then write a program using the Database such that if an employee name is Asked to Display it also display his bosses with his name. For eg. If C is displayed it should also display D and E with C?
Write a function that swaps the values of two integers, using int* as the argument type?
write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;
What is setf in c++?
What is an undefined behavior and sequence points
What are the differences between java and c++?
What is the difference between a declaration and a definition?
What is the difference between strcpy() and strncpy()?