"Parameter" vs "Argument"

FunctionParametersLanguage AgnosticArgumentsTerminology

Function Problem Overview


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?

Function Solutions


Solution 1 - Function

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiondummyView Question on Stackoverflow
Solution 1 - FunctiontranmqView Answer on Stackoverflow