Arguments and Parameters

What is the difference between functional arguments and functional parameters?

Questions by rbramu

Showing Answers 1 - 1 of 1 Answers

saritha1406

  • Oct 13th, 2010
 

The argument & parameter are used interchangeably in the literature,
C++ standard makes a clear distinction between them,
An argument is
1) An expression in comma seperated list in a function call
2)A sequence of one or more preprocessor tokens in the comma seperated list in a macro call
3) The operand of a throw-statement or an expression type
4)Template name in the comma seperated list in the angle brackets of a template instantiation.

A Parameter is
1)An object or reference that is declared in a function declaration or definition
2)In catch clause of an exception handler
3)An identifier between the paranthesis immediately following the macro name in a macro definition
4) Template parameter

For Example

void func(int n, char * pc); //n and pc are parameters
template <class T> class A {}; //T is a a parameter

int main()
{
  char c;
  char *p = &c;
  func(5, p); //5 and p are arguments
  A<long> a; //'long' is an argument
  A<char> another_a; //'char' is an argument
  return 0;
}

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions