Function Calls

A function call consists of the name of a function, the passing of values to the function and optionally using the return value. The return value can be used in an expression, written to a variable or ignored.

Passing values

Values are passed to the parameters of the function. A value can be passed as a variable or as a result of an expression.

If a parameter holds a reference, then the function can change the contents of the variables refered to.

Return value

The return value is either:

  • used in an expression, e.g. as in the line g(f(x) + 1).
  • written to a variable, e.g. as in the assignment a = f(x).
  • ignored, e.g. as in the line f(x).

Example

The following calls the function named f and sets the parameters to a+1, b and c*3.

f(a+1, b, c*3);