有没有办法让这个编译?
并使它使用具有整数默认值的fct?
使用g ++.
#include <stdio.h>
int fct(int a = 0)
{
printf("a: %d\n", a);
return (0);
}
void fct()
{
}
int main(void)
{
fct();
return (0);
}
Run Code Online (Sandbox Code Playgroud)
不,因为一旦你向fct(int)编译器添加默认值就无法猜出你要调用哪一个:
fct(int) 默认值为argfct()您可以做的是删除默认值,并完全调用fct(0)或删除没有参数的值.
| 归档时间: |
|
| 查看次数: |
655 次 |
| 最近记录: |