GfG QA is closing soon... Please refer PRACTICE or GfG now on wards !!

function overloading

int f ( int x, int y = 10) {

    return x+y;

}

in the snippet, what is the meaning of int y = 10 and why it is written like so?? 

asked Oct 4, 2016 by bambhole

2 Answers

answered Oct 4, 2016 by anonymous
int y=10 is a default parameter.Default parameters are used when we dont pass the required no of arguments.At that time this default values are used,if we pass required arguments it will take only the given value instead of default value.It is generally used when we dont pass req no of args only.I hope u can understand this.Uf u want more ask me
answered Nov 28, 2016 by Yashu guntur
...