C++ Functions Pass by Value or Reference

Subscribers:
50,600
Published on ● Video Link: https://www.youtube.com/watch?v=77XcoXwoK2c



Duration: 11:24
268 views
17


C++ Pass by Value or Pass by Reference in functions? In this video we will look at several function examples where we would want to pass parameters by value or by reference. When we pass by value, we are making a copy of the value. Generally, we want to pass by value for primitive data types because it is more performant to just make that copy because of how references are implemented. For larger data types such as strings and vectors, we want to pass by reference only if we don't want to make a copy. And if we don't want to make a copy nor modify the values, we pass by const reference.

If you need to review these topics:
Functions: https://youtu.be/65PSQUdH5k0
References: https://youtu.be/yoSEkrhmJDU

C++ Playlist:
https://www.youtube.com/playlist?list=PLnKe36F30Y4ZDNIOZ51sX25pWKQ1pkpTE

Install C++ with VS Code:
https://youtu.be/DMWD7wfhgNY

Subscribe for more coding tutorials 😄!







Tags:
c++ functions
C++ functions
functions c++
functions C++
functions in c++
functions in C++
c++ functions pass by value
c++ function pass by value
c++ functions pass by reference
c++ function pass by reference
pass by value c++
pass by reference c++
pass by value C++
C++ functions pass by value
C++ functions pass by reference
pass by value c++ functions
pass by reference c++ functions
pass by value C++ functions
pass by reference C++ functions