CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2009
    Posts
    24

    Question 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?

  2. #2
    Join Date
    Jan 2008
    Location
    California, USA
    Posts
    822

    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.

  3. #3
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    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.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  4. #4
    Join Date
    Apr 2007
    Location
    Mars NASA Station
    Posts
    1,436

    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.

  5. #5
    Join Date
    Jun 2008
    Posts
    592

    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
  •  





Click Here to Expand Forum to Full Width

Featured