Back to Browse

C++ Functions Pass by Value or Reference

2.0K views
Apr 15, 2024
11:24

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 Github Repo for C++ Code: https://github.com/ImKennyYip/cpp Install C++ with VS Code: https://youtu.be/DMWD7wfhgNY Subscribe for more coding tutorials 😄! ⭐ If you enjoyed the tutorial and would like to support the channel, you can do so here 💖: https://buymeacoffee.com/kennyyipcoding

Download

1 formats

Video Formats

360pmp416.0 MB

Right-click 'Download' and select 'Save Link As' if the file opens in a new tab.

C++ Functions Pass by Value or Reference | NatokHD