Answers for "how to make a parameter optional in c++"

C++
0

how to make a parameter optional in c++

void myfunc(int blah, int mode = 0)
{
    if (mode == 0)
        do_something();
     else
        do_something_else();
}
//Optional parameter must be the rightmost parameter.
Posted by: Guest on August-09-2021

Code answers related to "how to make a parameter optional in c++"

Browse Popular Code Answers by Language