What is pass-by-reference in C++?
20 views
- Passing the address of a variable to a function. (Correct Answer)
- Passing the value of a variable to a function.
- Passing a copy of a variable to a function.
- None of the above.
Explanation
Correct answer: a) Passing the address of a variable to a function.
Explanation: Pass-by-reference in C++ is a way of passing variables to a function by their memory address, rather than by their value. This allows the function to modify the variable directly, rather than working with a copy.