C++ Functions Pass by Value or Reference

Поделиться
HTML-код
  • Опубликовано: 14 апр 2024
  • 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: • C++ Functions
    References: • References in C++
    C++ Playlist:
    • C++ Programming Tutorial
    Install C++ with VS Code:
    • How to set up C++ in V...
    Subscribe for more coding tutorials 😄!

Комментарии • 2