Is there a way to make this compile?
and make it so it uses the fct with an integer default?
using g++.
#include <stdio.h>
int fct(int a = 0)
{
printf("a: %d\n", a);
return (0);
}
void fct()
{
}
int main(void)
{
fct();
return (0);
}
No, because once you added default value to
fct(int)compiler can’t guess which one you want to call:fct(int)with default value of argfct()What you can do is remove default value, and call
fct(0)or remove the one without arguments completely.