1
How to omit specific arguments of the function in C++ for which standard values were given in the function prototype parameters?
E.g. how to omit the second argument (b = 4 by default), passing the first and last?
#include <iostream>
using namespace std;
int SOMA(int a=2, int b=4, int c=5)
{
int s;
s=a+b+c;
return (s);
}
int main ()
{
//b e c omissos
cout << SOMA(1) << '\n'; //10
//b omisso
cout << SOMA(1,,2) << '\n'; //erro
return 0;
}
I believe this is a feature that only languages that allow calling the function with named parameters have, such as the Python.
– Woss