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.

Author: Tanmay Chakrabarty

Tanmay Chakrabarty is a former CSE student, currently working as a Senior Software Engineer with 5+ years of experience in the field of Web Application development in PHP+MySQL platform with strong skills in Javascript, JQuery, JQuery UI and CSS. He tries to write notes every week but fails due to heavy loads of duty.

Recommended Recommends

Comments

Contact Us