-
What is the output of this program?
#include
using namespace std;
int function(int p = 12, int q)
{
int s;
s = p + q;
return s;
}
int main()
{
cout << function(15);
return 0;
}
-
- 15
- 12
- Runtime Error
- Compilation Error
- None of these
Correct Option: D
We can’t use the user argument in front of the default argument.
Compilation Error
In function 'int function(int, int)':
3:9: error: default argument missing for parameter 2 of 'int function(int, int)'