C++ lets the programmer to assign default values in the function prototype declaration of the function.When the function is called with less parameter or without parameters the default values are used for the operations .It is not allowed to assign default values to any variables,which is between the variable list.
Read more →
Example:-
#include<iostream.h>
#include<conio.h>
int main()
{
Clrscr ();
int sum (int a, int b=10, int c=15, int d=20);
Int a=2;
Int b=3;
Int c=4;
Int d=5;
Cout<<”Sum=”<
Cout<<”/nSum=”<
Cout<<”/nSum=”<
Cout<<”/nSum=”<
Cout<<”/nsum=”<
Return 0;
}
Sum(int j, int k, int l, int m)
{
Return (j+k+l+m);
}
OUTPUT :
Sum = 14
Sum = 29
Sum = 40
Sum = 47
Sum = 32