web analytics

What are parameters in functions?




Function Parameter: Function parameters are variables of a function that we can use to send data to the function. Parameters are declared as follows:





function function_name(int var_a, float var_another){
//do something here
}

Here in the above function var_a and var_another are two parameters of the function called function_name. When making a call to that function as follows

function_name(5, 5.5);

we are sending 5 as the value of var_a and 5.5 as the value of var_another to the function. We can then use these two variables inside the function to generate result as per the need.

Thank you. Take a moment to share 🙏