C++ Const Reference

Поделиться
HTML-код
  • Опубликовано: 16 апр 2024
  • Const Reference in C++. In C++, there is a term called const correctness which is the practice of adding const when not modifying values. In C++, when we create temporary variables such as function parameters or the variable used for ranged base for loops, we create a copy of the value. This can be expensive for non primitive data types such as strings and vectors where we copy over every element in the collections. Therefore it is better to use a reference and if not modifying the values, a const reference. Because of how references are implemented, it is actually more efficient to just copy the primitive data types.
    If you need to review these topics:
    Functions: • C++ Functions
    Pass by Value vs Reference: • C++ Functions Pass by ...
    C++ Playlist:
    • C++ Programming Tutorial
    Install C++ with VS Code:
    • How to set up C++ in V...
    Subscribe for more coding tutorials 😄!

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

  • @thebishop5361
    @thebishop5361 2 месяца назад

    Can you make a video on how to create a website game like thr immaculate grid or pokedoku

    • @KennyYipCoding
      @KennyYipCoding  2 месяца назад

      Ive never heard of these games but I have many tutorials on grid based website games that you can find on my channel. Maybe they’ll help you make those games