Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

python
java
c++

Parameter vs. argument

Anusheh Zohair Mustafeez

Beginner programmers often find themselves interchangeably using the terms parameter and argument. However, these two terms are not the same. Luckily, it’s not hard to wrap your head around the differences.

A parameter is a variable in a function definition. It is a placeholder and hence does not have a concrete value.

An argument is a value passed during function invocation.

In a way, arguments fill in the place the parameters have held for them.

The diagram below shows the differences clearly:

Let’s look at arguments and parameters in Python, C++, and Java. The code below shows a simple function called introduction, which prints the name and age of a person:

#include <iostream>
using namespace std;

// Here name and age are parameters of the introduction function
void introduction(string name, int age){
  cout << "Hello! My name is " << name << " and I am " << age <<" years old."<< endl;
}

int main() {
  // Here Jerry and 15 are arguments passed to the introduction function 
  introduction("Jerry", 15);
  return 0;
}

RELATED TAGS

python
java
c++

CONTRIBUTOR

Anusheh Zohair Mustafeez
RELATED COURSES

View all Courses

Keep Exploring