I don't understand the difference between parameters and arguments, if they're both being sent to a function to be processed, and they're both variables, what's the difference? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I don't understand the difference between parameters and arguments, if they're both being sent to a function to be processed, and they're both variables, what's the difference?

11th Mar 2016, 9:14 PM
Heather Brown
Heather Brown - avatar
4 Answers
+ 7
when you are defining a function, you say what parameters it would work with. example: density(mass, volume). when you call that function, you replace each parameter with an actual value. these actual values are the arguments. say you want to calculate the density of a ball of mass 12kg and volume 4m³, you call the function 'density' with the arguments 12 and 4, like so: density(12, 4);
4th Aug 2016, 12:44 AM
Chimaobi Christian Okeke
+ 4
no parameter is called when we are declaring function writing its prototype whereas arguments word is used while calling out that function
10th Jun 2016, 11:08 PM
alok
alok - avatar
+ 3
Argument is used to specify the value passed. Parameter is used to specify the type and the variable which will hold the value
1st Jul 2016, 8:17 AM
Midhun Mathew
0
oh wait, the argument is a value and the parameter is a variable. Is that it?
11th Mar 2016, 9:16 PM
Heather Brown
Heather Brown - avatar