Search⌘ K

Arguments and Function Scope

Explore how C++ functions manage arguments by copy or reference. Understand the differences between pass-by-value and pass-by-reference, and learn how to control variable changes inside and outside function scope. This lesson equips you to write more precise and effective functions in your code.

We'll cover the following...

In the previous lesson, we learned how to pass arguments into a function. It is a very simple process, but there are a few things we need to know about how the C++ compiler treats these arguments.

Pass-by-Value

The compiler never actually sends the variables into the function. Instead, a copy of each argument is made and used in the scope of the function. This ...