8.2 Parameters and arguments

There is a difference between a parameter and an argument. Let us use the following example:

int f(int x)
{
  return x + 1;
}

In the line int f(int x), x is a parameter. It is also called a formal argument. This is because x specifies a placeholder that will be substituted by a value.

In the line return x + 1;, x is an argument because it is used to provide a value in a subroutine call.



Copyright © 2006-09-25 by Tak Auyeung