I am wondering how I can skip overriding a parameter in a C++ function. For example, looking at the function below, if output has 1 parameter, you can just call it without sending any parameters, like output();
That will output 5 since xor has a default value of 5. However, if I want to override "vor", and leave xor to its default value, how do I do that?
output(NULL, 20);
Above didn't work, it just initalized xor to 0.
void output(int xor = 5, int vor = 15) { cout << xor << " " << vor << endl; } int main() { output(10, 20); }