c++ default value in function call

saravanan_'s Avatar, Join Date: Oct 2007
Go4Expert Member
hi ,
I am new to this forum. Any one pls. give me a solution for my problem.
i have a c++ function
void func(int a=10,int b=20)
{
..........
}

i need to call the function with only one argument depends on certain condition.
some time i need call with two arguments.
I tired with two arguments and with one in first argument say
func(12);
the above one is working but, i want to call the function with
func(,59);
pls give me a solution for the above one.

Thanks in advance..
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
You need to pass a value for the first argument always. It cannot be that you don't provide an argument for the first in the list. You can use 0 of course.
0
saravanan_'s Avatar, Join Date: Oct 2007
Go4Expert Member
First of all Thanks .....shabbir for your reply...
So i have to pass the 1st and 2nd argument also...
Actually in PL/SQL it is possible to pass the 2nd args only, that why i asked this question.
Once again thanks for the reply..