Question : what is the difference between parameter and argument?

Question : what is the difference between parameter and argument?

Diff b/w parameter and argument is :
Argument bassically is one of the following -
> An Expression in the comma-separated list in a function call.
> A sequence of one or more preprocessor tokens in the comma-separated list in a macro call.
> Its represent the value which you pass to a procedure parameter when you call the procedure. The calling code supplies the arguments when it calls the procedure.
> It is something passed into a function(value), whereas a parameter is the type of data plus the name.
Parameter bassically is one of the following -
> An object that is declared in a function declaration or definition.
> An identifier b/w the parentheses immediately following the macro name in a macro definition.
> It is represent a value that the procedure expects you to pass when you call it. The procedure's declaration defines its parameters. 
       This example explains the difference b/w a parameter and an argument:

void function(int x, char * rs); //x and rs are parameters
template  class M {}; //Tem is a  parameter

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

By:UMANG
Date:2030-12-08 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related C Subjective Links

C Subjective interview questions and answers for experienced and fresher