Question #157627

What is the difference between function argument and parameter?


Expert's answer

Parameters of a function are the variables that appear in the function definition. The manes of these variables are used in the function body for doing its work.

Arguments are the values that are passed to the function when it is called. These values are used in real calculations.

For example in

int add(int a, int b) {
  return a+b;
}

int main() {
  int x=1, y=2, z=0;
  z = add(x, y);
  return 0;
}

a and b are parameters of the function add, while x and y are its arguments.


LATEST TUTORIALS
APPROVED BY CLIENTS