Function & Parameter | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Function & Parameter

What is the main difference between function and parameter in c++ ??

21st Feb 2017, 4:37 PM
N1H4R
N1H4R - avatar
4 Answers
+ 1
parameters are conatined in a function. function executes a certain task using the parameters provided.
21st Feb 2017, 5:15 PM
Sandip
+ 1
and how parameter is different from argument ?
21st Feb 2017, 6:03 PM
N1H4R
N1H4R - avatar
0
A function is basically a series of code statements that you can reference by name. A parameter is information that you can send to a function to alter or determine its output. For example: float getShippingCost(float weight, float price); This function would accept the parameters (arguments) of weight and price. The weight and price can then be used by the function to calculate the correct shipping cost. To get the shipping cost for a specific item, you could say: float shipping = getShippingCost(13.0f, 1.39f);
21st Feb 2017, 8:04 PM
Tim Helland
Tim Helland - avatar
0
parameters and arguments mean the same thing.
22nd Feb 2017, 11:22 AM
Sandip