Argument:
An argument is something passed into a function(value).
Parameter :
parameter is the type of data + (plus)the name.
Examples of both:
int Main()
{
int k=3; int l=5;
return mul(k,l); //here k,l are the arguments
}
int mul(int x, int y) // here x,y are the parameters
{
return x*y;
}
explanation : In main method you are passing 3 and 5 those are arguments, mul() takes in two int's. Those are the parameters
An argument is something passed into a function(value).
Parameter :
parameter is the type of data + (plus)the name.
Examples of both:
int Main()
{
int k=3; int l=5;
return mul(k,l); //here k,l are the arguments
}
int mul(int x, int y) // here x,y are the parameters
{
return x*y;
}
explanation : In main method you are passing 3 and 5 those are arguments, mul() takes in two int's. Those are the parameters
No comments:
Post a Comment