Parameter : Parameter represents a value which is to be passed while defining a function.
Usage:
int sum(int a, int b)
{
return a+b;
}
In the above example a & b integer variables are parameters.
Argument: Argument represents a value which is passed to function while calling.
Usage:
To find the sum of two numbers we can call the above function by passing values like below
Calling sum(4,5) will give the sum of the numbers passed.
Here 4 & 5 are called as arguments
No comments:
Post a Comment