Barry said:
As I recall that code
often written as
int main(int argc, char* argv[]);
template <class Arg>
void f(Arg arg) {}
which are kinda misleading in recalling the difference between
argument and parameter.
Yes. You should consider:
int fun(int x,int y);
sin(3,42);
The parameters of the function fun are x and y.
The arguments of the function call on the second line are 3 and 42.
The argument 3 is assigned to the parameter x, and the argument 42 is
assigned to the parameter y.
We need to distinguish these qualifiers, to talk unambiguously about calls such as:
int gcd(int x,int y){
return((x==y)
?x
(x<y)
?gcd(x,y-x)
:gcd(y,x-y)));
}
Where we can say that in the last call to gcd, the argument y is
passed to the parameter x, and the argument x-y is passed to the
parameter y.
Of course, since main takes as parameters the arguments given to the
program, we can name a parameter argument.
int f(int argument){
return((argument==1)
?1
(argument%1)
?f(3*argument)
:f(argument/2)));
}
So we can say that the argument argument/2 is passed to the parameter
argument.