fun()函数括号内填的都是什么意思了?

例如下面的!fun()内的是什么意思?
#include<studio.h>
int f(int t [ ],int n);
main()
{int a[4]={1,2,3,4},s;
s=f{a,4}; printf(”%d\n”,s);
}
int f(int t[], int n)
{ if (n>0) return t[n-1]+f(t,n-1);
else return 0;
}

int t[] 这是一个整型的数组参数,int n,是整型。而函数f(int t[],int n)是一个递归函数,你写的这个递归函数应该是错的,自己再去看看书上的递归函数怎么写的吧
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-03-25
int f(int t [ ],int n);
//这是函数的声明, ()中是输入参数的类型, 第一个参数是数组, 第二个是数值数组的长度.
main()
{int a[4]={1,2,3,4},s;
s=f{a,4}; // 函数的调用, a是数组, 4是数组长度
printf(”%d\n”,s);
}
// 这是函数定义, 是一个递归函数, 实现相加
int f(int t[], int n)
{ if (n>0) return t[n-1]+f(t,n-1);
else return 0;
}本回答被提问者采纳
第2个回答  2011-03-25
fun函数是嵌套形式,求a[3]+a[2]+a[1]+a[0]的和
第3个回答  2011-03-25
形参
第4个回答  2011-03-25
仔细看书