Function Parameter vs. Argument
When talking about functions, the words "parameter" and "argument" may appear at first to be interchangeable. However, for many programming languages, the words actually refer to two different things. In short:
- A parameter is part of the function's definition: an input that the function expects.
- An argument is part of a function call: a value passed to the function to satisfy one of the parameters required by the function definition.
1 2 3 4
b are parameters of the function
If we then call the function:
3 are arguments of the
add( 2, 3 ) function call statement. The argument
2 satisfies parameter
a, and argument
3 satisfies parameter
Many popular programming languages today derive their usage of the terms from earlier sources like:
- Section 1.7, Functions, in Kernighan, Brian W., and Dennis M. Ritchie, The C Programming Language, 2nd ed., Prentice Hall PTR, 1988, p. 25. This book is often called "K & R" (the initial letters of its authors' last names).