请问TC3下如何定义和调用函数?
#include <stdio.h>
main()
{ int n=4,x=2,s;
s=fun(x,n);
printf("s=%d\n",s);
}
fun(int x,int n)
{ if(n==1) return(x);
else return(x*fun(x,n-1));
}
以上代码在TC2下能成功编译,但在TC3下编译时显示:
Compiling ..\..\1.CPP:
Error ..\..\1.CPP 5: Function 'fun' should have a prot
Warning ..\..\1.CPP 7: Function should return a value