Dear Friends,
I faced a compilation error in the following code :
Code:
#include <iostream>
using namespace std;
void addition(int a, int b = 2, int c);
int main()
{
int a = 10, b = 20, c = 30;
addition(10,20,30);
return 0;
}
void addition(int a, int b, int c)
{
cout << "\n Sum = "<< a + b + c;
return;
}
Error : default argument missing for parameter 3 of ‘void addition(int, int, int)’
My question is that when i have called addition() with the 3rd argument, then what is the necessity of having the default argument for the 3rd parameter ?