Functions

Lessons in this group, roughly in build order:

  • declaring-defining-functions — A declaration names a function and its type so the compiler can call it; a definition supplies the body —…
  • parameters-and-arguments — A parameter is the variable in a function’s declaration; an argument is the concrete value you bind to it…
  • pass-by-value-reference-pointer — The three ways to hand data to a function — copy it, alias it, or pass its address — each pick a different…
  • default-arguments — A default argument lets the caller omit a trailing parameter, with the compiler substituting a value…
  • function-overloading — Overloading lets several functions share a name and be told apart by their parameter lists, with the…
  • inline-functions — The inline keyword’s real job is an ODR exemption — it lets a function be defined in a header and included…
  • lambda-expressions — A lambda is syntax for an anonymous function object — the compiler generates a unique unnamed class with…
  • constexpr-functions — A constexpr function may run at compile time when its arguments are constant expressions, folding work…
  • recursion — Recursion is a function calling itself to solve a problem by reducing it to smaller instances — in C++ it…