3.2 PARAMETER PASSING

Functions normally work in terms of arguments that are called parameters. The parameters used in function declaration (and definition) are called formal parameters. The parameters used while calling a function are called actual parameter. Actual parameters can be a variable or a constant or an expression.

In general, term argument and parameter are used synonymously. Critically speaking, the parameters when passed to functions (for execution) are called arguments. Consider function sin (x). Here x is the parameter. The function calculates the value of sine of x. In this sense, parameter x is an input to the function. In C++, parameters can be passed in two different ways:

  1. call by value and
  2. call by reference

3.2.1 call ...

Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.