Difference between parameter and argument

Chunky Chunk picture Chunky Chunk · Jul 4, 2010 · Viewed 140k times · Source

Is there a difference between a "parameter" and an "argument", or are they simply synonyms?

Answer

danlei picture danlei · Jul 4, 2010

Argument is often used in the sense of actual argument vs. formal parameter.

The formal parameter is what is given in the function declaration/definition/prototype, while the actual argument is what is passed when calling the function — an instance of a formal parameter, if you will.

That being said, they are often used interchangeably, their exact use depending on different programming languages and their communities. For example, I have also heard actual parameter etc.

So here, x and y would be formal parameters:

int foo(int x, int y) {
    ...
}

Whereas here, in the function call, 5 and z are the actual arguments:

foo(5, z);