Geeks With Blogs


View Anthony Trudeau's profile on LinkedIn

Add to Technorati Favorites

Anthony Trudeau

I've heard the terms parameter and argument used incorrectly countless times; and sometimes they're used interchangeably within the same paragraph.  I understand the possibility that some language out there may muddy the generally accepted definition of these terms, but let me clarify the difference.

A parameter is part of a function definition.  Parameters refer to the definition of the specific, special variables that are part of that definition.  The actual values whether literals, constants, or whatever that are provided are called arguments.  You can say that the arguments are passed to the parameters of the function.

void dosomething(int, int);

int main {
     int a = 10;

     dosomething(a, 5);     // a and 5 are arguments
     return 0;

void dosomething(int p1, int p2) {
     // p1 and p2 are parameters

Posted on Friday, July 27, 2012 10:21 PM | Back to top

Comments on this post: Parameter vs. Argument

# re: Parameter vs. Argument
Requesting Gravatar...
This will help for my programm course on friday
Left by jessyberlin on Oct 18, 2012 10:56 AM

Your comment:
 (will show your gravatar)

Copyright © Anthony Trudeau | Powered by: