Parameters and arguments

For functions in C++, the tutorial says its syntax is :

type name (parameter 1, parameter 2, ... ) {statement}

and a bit later, some down side of the same page, its syntax is :

type name ( argument1, argument2 ...) { statements }

I see no clear descreption of the deference between parameter and arguments,

are they just same thing in different name?


The page is here
http://www.cplusplus.com/doc/tutorial/functions/
Last edited on
parameters are in the function definition, arguments are at the site of function call.

parameters and arguments should correspond to each other: each argument has its parameter. Arguments are expressions, parameters are variables. On function call, the value of each argument gets copied to its corresponding parameter.
Last edited on
Oh, about that mention of arguments: sometimes, people use the word 'argument' less strictly, so that it means the same as parameters. In that second mention, it should really say 'parameters' instead of arguments.
Thank you Kevin C!

what about the words arguments and parameters in the description just below the second sytax?( the syntax including (argument1, argument2,...)

I brought some part of it :

This function takes two strings as parameters (by value), and returns the result of concatenating them. By passing the arguments by value, the function forces a and b to be copies of the arguments passed to the function when it is called. And if these are long strings, it may mean copying large quantities of data just for the function call.

Arguments by reference do not require a copy. The function operates directly on (aliases of) the strings passed as arguments, and,
--------------------------------------------------------------------------------
I think all the words argument here would be parameters considering your explain. is that right?
Last edited on
"This function takes two strings as parameters" - it would be better to say:

This function takes two strings as arguments
or
This function has two strings as parameters

The remainder of the text seems OK. Arguments are passed by value (to parameters), the functions forces *parameters* a and b to be copies of the arguments.

Passing arguments by reference (to parameters) does not require a copy...

...everything else is fine.
it helps me to fix my confusion. I appreciate it, Kevin C.

even a little errors make me confused a lot.

I will read it taking long time thanks!
Topic archived. No new replies allowed.