An argument is referred to the values that are passed within a function when the function is called. These values are generally the source of the function that require the arguments during the process of execution. These values are assigned to the variables in the definition of the function that is called. The type of the values passed in the function is the same as that of the variables defined in the function definition. These are also called Actual arguments or Actual Parameters.
Example: Suppose a sum() function is needed to be called with two numbers to add. These two numbers are referred to as the arguments and are passed to the sum() when it called from somewhere else.
The summation is 30
The parameter is referred to as the variables that are defined during a function declaration or definition. These variables are used to receive the arguments that are passed during a function call. These parameters within the function prototype are used during the execution of the function for which it is defined. These are also called Formal arguments or Formal Parameters.
Example: Suppose a Mult() function is needed to be defined to multiply two numbers. These two numbers are referred to as the parameters and are defined while defining the function Mult().
The multiplication is 200
Difference between Argument and Parameter
|When a function is called, the values that are passed during the call are called as arguments.||The values which are defined at the time of the function prototype or definition of the function are called as parameters.|
|These are used in function call statement to send value from the calling function to the receiving function.||These are used in function header of the called function to receive the value from the arguments.|
|During the time of call each argument is always assigned to the parameter in the function definition.||Parameters are local variables which are assigned value of the arguments when the function is called.|
|They are also called Actual Parameters||They are also called Formal Parameters|
- Argument vs Parameter in Java
- Argument Coercion in C/C++
- Variable Length Argument in C
- Why copy constructor argument should be const in C++?
- C function argument and return values
- How to pass a 2D array as a parameter in C?
- Parameter Passing Techniques in C/C++
- How to print size of array parameter in C++?
- Difference between an Integer and int in Java with Examples
- Difference Between malloc() and calloc() with Examples
- Difference between Iterators and Pointers in C/C++ with Examples
- Difference between Java and Kotlin in Android with Examples
- Difference between Abstraction and Encapsulation in Java with Examples
- Difference between Iterator and Enumeration in Java with Examples
- Difference between super and super() in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.