733

I got parameter and argument kind of mixed up and did not really pay attention to when to use one and when to use the other.

Can you please tell me?

5
  • 129
    In Russian "parameters" are called "formal parameters", while "arguments" are called "actual parameters".
    – Dims
    Commented Jun 11, 2013 at 10:38
  • 11
    We use this convention italian as well.
    – Dacav
    Commented Dec 4, 2013 at 13:29
  • 217
    I like this quote from MSDN: "...the procedure defines a parameter, and the calling code passes an argument to that parameter. You can think of the parameter as a parking space and the argument as an automobile." Commented Dec 16, 2014 at 21:24
  • 4
    argument is the one you use it, while parameter is a blank to be filled in.
    – user8445949
    Commented Sep 22, 2017 at 9:14
  • 2
    We pass argument(s) while calling a function and the function receives as parameter(s). Commented Jul 7, 2021 at 0:23

1 Answer 1

1241

A parameter is the variable which is part of the method’s signature (method declaration). An argument is an expression used when calling the method.

Consider the following code:

void Foo(int i, float f)
{
    // Do things
}

void Bar()
{
    int anInt = 1;
    Foo(anInt, 2.0);
}

Here i and f are the parameters, and anInt and 2.0 are the arguments.

17
  • 221
    Old post, but another way of saying it: argument is the value/variable/reference being passed in, parameter is the receiving variable used w/in the function/block.
    – vol7ron
    Commented May 8, 2013 at 15:47
  • 103
    Or, a method has parameters and takes arguments.
    – kasperhj
    Commented May 29, 2015 at 7:07
  • 35
    Someday I will explode and it will be a shower of developer's lingo. Commented Jun 10, 2015 at 20:28
  • 8
    Why is it that within JavaScript, when you want to access the parameters of a function/method, you have to access the "arguments" variable? Shouldn't that be "parameters" instead? Commented Jul 28, 2015 at 19:04
  • 24
    @ngDeveloper Nope, it should be arguments. You get access to the list of argument values passed to the function. Consequently you don't get a list of the parameter names of the function, javascript doesn't give you a way to get that info.
    – B T
    Commented Nov 9, 2015 at 2:10