What is the primary advantage of passing parameters by reference over passing them by value?
- Reduced memory usage
- Faster program execution
- Modifying the actual variable
- Ensuring data privacy
Passing parameters by reference allows for direct access to the original memory location, eliminating the need for copying data. This reduces memory overhead and can enhance the performance of the program. While options 2 and 3 can also be benefits of passing by reference, the primary advantage is the reduction of memory usage.
Loading...
Related Quiz
- The _______ function is used to move the file pointer to a specified position in the file.
- How does C++ treat an enum regarding its type and size?
- Which function is used to get the position of the file pointer in a file?
- How does encapsulation aid in reducing software development complexity?
- In a class template, the keyword _______ is used to create an instance of the template.