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
What is the use of register keyword with the variables?
What are shallow and deep copies?
What is c++ mutable?
What is a node class in c++?
How do you define a class in c++?
What's the order in which the local objects are destructed?
What is difference between class and structure in c++?
What is boyce codd normal form in c++?
Is C++ case sensitive a) False b) Depends on implementation c) True
Why c++ is better than c language?
What is the iunknown interface?
find the two largest values among the 6 numbers using control structures : do-while,for,if else,nestedif- else ,while. one or two of them.
What is an adjust field format flag?
What is c strings syntax?
Describe protected access specifiers?