Parameters and Arguments Difference

Parameters and Arguments Difference
 
Who is the Intended Audience?

This article is basically for those programmers who have just stepped into this vast world of programming.
 
Introduction

As soon as you start programming you will sooner or later come to the words Parameters and Arguments. What are they? In day to day programming we use tons of parameters and arguments. Lets just get into the depth of it.
 
Definition
 
Parameter

In programming language, a parameter is a special kind of variable, used in a function or a subroutine to refer to one of the pieces of data provided as input to those functions. These pieces of data are nothing but arguments.
 
Whenever we define a function we define a set of parameter list in the parentheses to get our work done. By doing this we are just transferring values over the program.
 
To define a parameter you provide a data type, a name of the parameter and the passing mechanism( ByRef or ByVal).  
 
Eg:
 
Public Function FunGetArea (ByVal IntPriRadius as Integer ) As double
                return (22 * IntPriRadius * IntPriRadius) / 7
End Sub
 
In the above example IntPriRadius is our parameter. Its data type is Integer. The functions return type is double.
 
You can give n number of parameters as per your requirement.
 
Parameters can sometime be optional meaning you don't have to pass the value that parameter always.
 
Arguments

An argument represents the value you pass to a procedure parameter when you call the procedure. The calling code supplies the arguments when it calls the procedure.
 
Always datatype of the argument should be the one which is specified in the parameter. You can pass the arguments by calling the defined function and immediately including values inside the parantheses.
 
In contrast to parameters arguments do not have names. They are simply the expressions, constants and values.
 
Eg:
 
In the above e.g. Onload function you can call
 
FunGetArea (10)
 
Thus,  from the examples it is clear that Parameter is “IntPriRadius” and “10” is the argument.
 
You can think of a parameter as an parking lot and argument as vehicles. Just as different vehicles can park in the   parking place at different times, the calling code can pass a different argument to the same parameter each time it calls the procedure.
 
Conclusion

Though we refer arguments and parameters as same they are different. Thank you all for having patience in reading.

Ebook Download
View all
Learn
View all