i have a little question, how can i initialize default arguments in an function?
#include <iostream>
#include <cmath>
using namespace std;
float area(float a, float b, float c);
float area(float a, float b=a, float c =a);
int main() {
cout << area(10) << endl;
return 0;
}
float area(float a, float b, float c){
return a*b*c
}
i am getting errors, how can i impelent correctly?
aas default parameter. Since multiple declarations are allowed, if you replaceaby something that can be evaluated when function is called everything will work fine, but you will have only 1 function.