TechnologyDifference Between an Argument and a Parameter

Difference Between an Argument and a Parameter

The words argument and parameter are often used interchangeably in the literature, although the C++ Standard makes a clear distinction between the two.

An argument is one of the following:

  • an expression in the comma-separated list in a function call;
  • a sequence of one or more pre processor tokens in the comma-separated list in a macro call;
  • the operand of a throw-statement or an expression, type, or template-name in the comma-separated list in the angle brackets of a template instantiation.

A parameter is one of the following

  • an object or reference that is declared in a function declaration or definition (or in the catch clause of an exception handler);
  • an identifier between the parentheses immediately following the macro name in a macro definition; or a template-parameter.

This example demonstrates the difference between a parameter and an argument

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;

Categories: Technology


  1. December 23, 2009 9:35 am

    I have seen your post and this post is very useful for us.I have read your all concepts that seems useful for us.

Post a comment

Your email address will not be published. Required fields are marked *