【发布时间】:2015-08-03 17:55:50
【问题描述】:
我是从 here 那里学到的
void f();
void f(int a) {
printf("%d", a);
}
参数类型列表“wins”。 我做了以下...
int fun(void); //parameter type list
int fun(int a, double b)//parameter type list
{
printf("%d, %f", a, b);
return 0;
}
我原以为编译器会抛出错误(因为在 c 中不可能重载),但它没有
有人可以在这方面帮助我吗?
谢谢。
【问题讨论】:
-
您使用的是什么编译器。它肯定会抛出一个错误..
error: conflicting types for ‘fun’ -
VS2013自带的
-
是的,你是对的,它抛出了一个错误。我检查了 gcc。但是为什么 VS 不这样做呢?
-
@RachanaPal 你确定你使用的是 VS C 编译器,而不是 C++?
-
你可能在 C++ 模式下编译它吗?