test.c:3: error: old-style parameter declarations in prototyped function definition
在看龙芯 开源社区 pmon代码时,有一个地方没理解,如下图:
自己模仿这个写法写个测试试试:
#include <stdio.h>
int add( a, b)int a,b;
{
return a+b;
}
int main()
{
int a,b;
a = 1;
b = 2;
printf("c = %d\n",add(a,b));
return 0;
}
编译成功,这才知道C语法还有个旧版和新版的区分。
旧版只是把参数定义写在了形参形参后边。