-
February 1st, 2009, 02:39 AM
#1
arguments and parameters difference
I already know what the difference is but does anyone know a good way to memorize the difference between the two?
-
February 1st, 2009, 04:05 AM
#2
Re: arguments and parameters difference
Hello E-man96,
That sounds like fun.
Hm, how about you look at the parameters as the Happy Meal and the arguments as what's in the bag? If there's no burger, fries, drink and pokemon action figure, then you know you didn't get the right meal.
-
February 1st, 2009, 06:45 AM
#3
Re: arguments and parameters difference
Using the definitions from Stroustrup's C++ glossary:
argument - a value passed to a function or a template. In the case of templates, an argument is often a type.
parameter - a variable declared in a function or templates for representing an argument. Also called a formal argument. Similarly, for templates.
Sometimes "argument" is used in both cases, upon which "actual argument" means argument and "formal argument" means parameter. Likewise, sometimes "parameter" is used in both cases, upon which "actual parameter" means argument and "formal parameter" means parameter.
EDIT:
Okay, I did not read the question very carefully... but I personally find it easy to distinguish between the two after some practice. Often it does not matter anyway as the terms might be used interchangeably.
Last edited by laserlight; February 1st, 2009 at 06:47 AM.
-
February 1st, 2009, 07:37 AM
#4
Re: arguments and parameters difference
Although the term was used interchangeably but i think it is better to differentiate it.
Code:
void display(vector<int>&) --- Paramater
vector<int> vec;
display(vec); --- Argument
Thanks for your help.
-
February 1st, 2009, 07:45 AM
#5
Re: arguments and parameters difference
A simple way to remember is to look at the what the function(or anything else like a template, class..) requires and this is the "parameters" and what I will pass is the "arguments".
0100 0111 0110 1111 0110 0100 0010 0000 0110 1001 0111 0011 0010 0000 0110 0110 0110 1111 0111 0010
0110 0101 0111 0110 0110 0101 0111 0010 0010 0001 0010 0001 0000 0000 0000 0000 0000 0000 0000 0000
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|