Difference between an argument and a parameter?

Answer Posted / dev

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

An argument is an expression in the comma-separated list in
a function call or the operand of a throw-statement

A parameter is an object or reference that is declared in a
function declaration or definition (or in the catch clause
of an exception handler);


This example demonstrates the difference between a
parameter and an argument:

void func(int n, Object obj); //n and obj are parameters

static void main(String s[])
{
Object p = new String("hi");
func(5, p); //5 and p are arguments
}

Is This Answer Correct ?    155 Yes 23 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is ststic with example

1591


What is the difference between state-based unit testing and interaction-based unit testing?

493


What is a functional interface?

543


How do you write methodology?

558


How is abstraction implemented in java ?

536






'A class is a template for an object' explain this statement.

544


Why we used vector class?

626


What is member in java?

488


Name component subclasses that support painting in java programming?

628


What is java life cycle?

533


What is java full form?

520


Does java support multiple inheritance or not?

593


Why are the destructors for base class and derived class called in reverse order when the program exits

1702


How is a variable stored in memory?

523


Can we use a default constructor of a class even if an explicit constructor is defined?

644