c++ - What kind of function calling is this? -
this question has answer here:
- default value of function parameter 4 answers
i seeing code snippet saw calling of function not understand.it this
void recursion(int v,int p=0) //definition { //whatever in body } main() { //something ... recursion(0);// *_* }
i taught in school calling , definition should have same number of arguments.but here not understand.it looks numbers of arguments can of different number.
that called default argument value. have specified after other arguments without default argument values.
then if don't specify argument in function call value used.
if have more 1 default argument, say:
void f(int first, int second = 0, char* third = "");
you have omit following default values if ommitting preceding one:
//you can f(0); f(1, 2); //but not f(1, "three");
Comments
Post a Comment