C++ : Default Arguments

Normally a function call statement should specify all the arguments used in the function definition.

In C++, we can provide default values for the arguments, and then while calling a method/function some of the arguments can be omitted.

Parameter without the default arguments/values are placed first and then arguments with the default values are placed.

Hence the feature of default arguments allows us to call a function with fewer arguments then defined in the function declaration/definition.  

Example:

Function Without default arguments:

function definition
void abc(int n1,int n2,int n3)
{
Statements
}

function calling
abc(1,2,3);//valid
abc(100,20,30);//valid
abc();//error
abc(10);//error
abc(10,4);//error

Function with default values:

function definition
void abc(int n1=76,int n2=9,int n3=10)
{
Statements
}

function calling
abc(); // (n1=76,n2=9,n3=10)
abc(10); //(n1=10,n2=9,n3=10)
abc(14,4);  //(n1=14,n2=4,n3=10)
abc(1,2,3); //(n1=1,n2=2,n3=3)