Need Assistance?

support@tutorialshub.in

Functions & Recursion

Pass by Value vs Pass by Reference (&)

ADVERTISEMENT
C++ Free Lesson
5 min read
ADVERTISEMENT

Passing large objects like std::vector or std::string by value copies all their elements! Always pass read-only objects by const T&, and pass T& when the function needs to modify the caller's variable.

ADVERTISEMENT
Hi, I'm Tuby! Here to help you