d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > A Little Fuzzy Still. > Parameters Vs. Arguments.
12Next
Add Reply New Topic New Poll
Member
Posts: 35,456
Joined: Jan 25 2009
Gold: 1,173.00
Apr 12 2014 03:38pm
Can someone give me a solid definition of this? I've looked around Google, stackflow, etc. but I am still a bit confused. Also what is the industry standard regarding the naming convention. Parameter and argument? Formal and actual parameters/arguments?
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Apr 12 2014 05:09pm
are you asking what the difference is between parameter and argument? arguments are passed, parameters are accepted

eg:

void mymethod(int param1, int param2){ // param1 and param2 are parameters
...
}

mymethod(1, 2); // 1 and 2 are arguments

generally, nobody cares if you mix them up. you can figure it out by context.

or are you asking how to name the parameters vs local variables? pick whatever you/group decide on.

This post was edited by carteblanche on Apr 12 2014 05:22pm
Member
Posts: 582
Joined: Mar 22 2014
Gold: 0.00
Apr 12 2014 05:44pm
Quote (carteblanche @ Apr 12 2014 07:09pm)
are you asking what the difference is between parameter and argument? arguments are passed, parameters are accepted

eg:

void mymethod(int param1, int param2){ // param1 and param2 are parameters
...
}

mymethod(1, 2); // 1 and 2 are arguments

generally, nobody cares if you mix them up. you can figure it out by context.

or are you asking how to name the parameters vs local variables? pick whatever you/group decide on.


Most important thing here
Member
Posts: 35,456
Joined: Jan 25 2009
Gold: 1,173.00
Apr 13 2014 04:44pm
Quote (carteblanche @ 12 Apr 2014 18:09)
are you asking what the difference is between parameter and argument? arguments are passed, parameters are accepted

eg:

void mymethod(int param1, int param2){ // param1 and param2 are parameters
...
}

mymethod(1, 2); // 1 and 2 are arguments

generally, nobody cares if you mix them up. you can figure it out by context.

or are you asking how to name the parameters vs local variables? pick whatever you/group decide on.


Thanks again buddy. That top part answered one question. My other question is:

For those who work in the industry writing code. Is it standard to call them Formal Parameters and Actual Parameters? Or Formal Arguments and Actual Arguments? Or finally, Parameters and Arguments.

I've noticed across the net people call it different things which can get confusing so what does the "industry" call it. Do they use formal vs. actual and is it parameter or argument or both?
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Apr 13 2014 04:53pm
Quote (NinjaSushi2 @ Apr 13 2014 06:44pm)
Thanks again buddy. That top part answered one question. My other question is:

For those who work in the industry writing code. Is it standard to call them Formal Parameters and Actual Parameters? Or Formal Arguments and Actual Arguments? Or finally, Parameters and Arguments.

I've noticed across the net people call it different things which can get confusing so what does the "industry" call it. Do they use formal vs. actual and is it parameter or argument or both?


you're over thinking this. language exists so people can communicate. if you understand what the other guy is talking about, kudos. i have never heard anyone prefix it with "formal" or "actual" to differentiate value vs variable, so don't ever use it.

imo it's kinda like the "who/whom" situation. the vast majority of americans use "who" for both cases, even though "whom" may be correct. and guess what? nobody cares. stick to whatever people around you are comfortable with.

i think you're imagining that developers sit around saying shit like "hey, can i pass my rate as an argument to your function?" dunno what you're expecting.

This post was edited by carteblanche on Apr 13 2014 04:56pm
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Apr 13 2014 05:21pm
Quote (carteblanche @ Apr 13 2014 05:53pm)
you're over thinking this. language exists so people can communicate. if you understand what the other guy is talking about, kudos. i have never heard anyone prefix it with "formal" or "actual" to differentiate value vs variable, so don't ever use it.

imo it's kinda like the "who/whom" situation. the vast majority of americans use "who" for both cases, even though "whom" may be correct. and guess what? nobody cares. stick to whatever people around you are comfortable with.

i think you're imagining that developers sit around saying shit like "hey, can i pass my rate as an argument to your function?" dunno what you're expecting.


To expand on this: the only people who I have found that care about using the correct terminology when talking about args vs params are interns looking to prove themselves. They seem to think we are more concerned with their vocabulary than their problem solving.

That isn't to say it doesn't matter. If I was to tell one of my team members "The functions args are wrong." That is a completely different sentence than saying "The functions params are wrong." The former suggests the function is being used improperly. The later suggests the function is declared improperly. Luckily for us, there is such a thing as context. And context allows us to discern just what it is we are talking about.

Member
Posts: 35,456
Joined: Jan 25 2009
Gold: 1,173.00
Apr 16 2014 06:09am
Cool. Thanks guys.
Member
Posts: 35,456
Joined: Jan 25 2009
Gold: 1,173.00
Apr 16 2014 03:53pm
Another question. So parameters are only used to initialize a function while arguments call a function? What about loops and such.

Code
int main()
{
// Call the showStatic function five times.
for (int count = 0; count < 5; count++)
showStatic();
return 0;
}


So int count = 0 is a parameter. Are count < 5; count++ the arguments or are those parameters as well?

Or is it that arguments are passed to parameters? I still am unsure as to what to call what in what situation. I guess I am still confused on when something is a parameter and when it is an argument. :blush:

This post was edited by NinjaSushi2 on Apr 16 2014 03:56pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Apr 16 2014 04:51pm
Quote (NinjaSushi2 @ Apr 16 2014 05:53pm)
Another question. So parameters are only used to initialize a function while arguments call a function? What about loops and such.

Code
int main()
{
// Call the showStatic function five times.
for (int count = 0; count < 5; count++)
showStatic();
return 0;
}


So int count = 0 is a parameter. Are count < 5; count++ the arguments or are those parameters as well?

Or is it that arguments are passed to parameters? I still am unsure as to what to call what in what situation. I guess I am still confused on when something is a parameter and when it is an argument.  :blush:


those are just expressions. "for" isn't a function. quit overthinking it.
Member
Posts: 35,456
Joined: Jan 25 2009
Gold: 1,173.00
Apr 16 2014 05:23pm
So a parameter defines the type/name/etc, while an argument is the value passed in.

edit: I know for isn't a function.

This post was edited by NinjaSushi2 on Apr 16 2014 05:24pm
Go Back To Programming & Development Topic List
12Next
Add Reply New Topic New Poll