+ 2
a parameter is a sort of argument that helps to declare new variables for that function. eg int carspeed (int speed1){ return speed1; } in the above example, int speed1 is a parameter of the carspeed function. In other words, speed1 is a variable of the carspeed function. Its just like declaring a new local variable inside a function. e.g int carspeed (){ int speed1; return speed1; } But the difference between declaring a variable as a parameter and declaring it as a local variable is that if you declare it as a parameter, you can easily input the value of speed1 in another function by simply calling the carspeed function like this int main (){ carspeed (15); return 0; } hope this helps.
26th Dec 2016, 7:17 AM
Cody Arthur
Cody Arthur - avatar