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

Which package is imported by default?

624


what is optional in java 8?

547


How do you define a set in java?

502


What is an interface in java? Explain

567


What is multi-catch block in java?

613






What is java in layman terms?

521


Is oracle charging for java?

542


Explain reverse a linked list iterative solution in java?

492


What are the benefits of immutable objects?

532


how come we know the object is no more used in the class?

5396


Are there structures in java?

550


What is thread count in java?

541


Why is singleton not thread safe?

643


How do you empty a list in java?

532


How objects of a class are created if no constructor is defined in the class?

574