Page 1 of 1

default value for parameters in gcc

Posted: Sat Jul 12, 2003 3:02 pm
by Hanzo
Is there a way to give default values to parameters of a function in gcc (in djgpp)?

void fnc(int a, int b=0); <<--??

fnc(10); = fnc(10, 0);
fnc(20, 15);

Re:default value for parameters in gcc

Posted: Sun Jul 13, 2003 1:27 am
by anubis

Code: Select all

void func(int a,int b=0)
{
  //functions definition (functions code)
}
I think this will work.

Re:default value for parameters in gcc

Posted: Sun Jul 13, 2003 1:47 am
by Pype.Clicker
this is a c++ only feature, isn't it ?