I want to create a function with an optional argument that takes the value of another argument. In the function declaration, the following does not work, but this is exactly what I want to do:
void function(int a, int b=a)
I am trying to set the default value of variable b to value a. What is the cleanest way to do this? Can we do this without changing the signature of the function?
source
share