#include int fun(int*x,int n) { if (n==0) return x[0]; else return x[0]+fun(x+1,n-1); }void main(){int a[]={1,2,3,4,5,6,7};printf("%d\n",fun(a,2) );}

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/26 23:06:51
#includeintfun(int*x,intn){if(n==0)returnx[0];elsereturnx[0]+fun(x+1,n-1);}voidmain(){inta[]={1,2,3,

#include int fun(int*x,int n) { if (n==0) return x[0]; else return x[0]+fun(x+1,n-1); }void main(){int a[]={1,2,3,4,5,6,7};printf("%d\n",fun(a,2) );}
#include int fun(int*x,int n) { if (n==0) return x[0]; else return x[0]+fun(x+1,n-1); }
void main()
{
int a[]={1,2,3,4,5,6,7};
printf("%d\n",fun(a,2) );
}

#include int fun(int*x,int n) { if (n==0) return x[0]; else return x[0]+fun(x+1,n-1); }void main(){int a[]={1,2,3,4,5,6,7};printf("%d\n",fun(a,2) );}
#include
int fun(int*x,int n)
{
if (n==0)
return x[0];
else
return x[0]+fun(x+1,n-1);
}
如果n = 0,那么返回 数组 x的第一个元素,如果 n !=0 那么后面将会是一个递归算法.
请把代码贴完,还有你想说明的是什么?想问什么?

#include stdio.h double fun(int m) { // } #include void fun(int a[],int n) { int i,t; for(i=0;i #include #include fun(int n) { int k,r; for(k=2;k #include int fun(int b[].int n) { int i.r=1:for(i=0:i #include long fun(int n) {long s; if(n #include int inc(int a){ return(++a); }int multi(int*a,int*b,int*c){ return(*c=*a**b); }typedef int(FUNC1)(int in);typedef int(FUNC2) (int*,int*,int*);void show(FUNC2 fun,int arg1,int*arg2){FUNC1 p=&inc;int temp =p(arg1);fun(&temp,&arg1,arg2);printf( #include double fun( int m ){double t = 1.0;int i;for( i = 2; i C++填空题1 求详解#include using namespace std;int fun(int x,int y){cout #include int inc(int a) { return(++a); } int multi(int*a,int*b,int*c) { return(*c=*a**b); }typedef int(FUNC1)(int in);  typedef int(FUNC2) (int*,int*,int*);  void show(FUNC2 fun,int arg1,int*arg2)  {  INCp=&inc;  int temp =p(arg1) C语言 这个fun函数哪里错了?#include #include #include void fun(char *a,int b[]){int i;for(i=0;i #include stdio.hint fun (int k,int *m){if (k%3) *m=k*k;else *m=k/3;}main(){int (*p) (int,int *),m;p=fun;(*P) (78,&m);printf ( %d ,m);} #include int b=2; int fun(int *k) {b=*k+b;return(b);} main() {int a[10]={1,2,3,4,5,6,7,8}, #include void fun(int p) { int d=2; p=d++; printf(“%d”,p);} main() { int a=1; fun(a); printf(“%d #include int main( ){int c;cout 下面的这个是参考答案上的程序# include void fun(int (*str)[10],int *a,int *n,int mm,int nn){int i,j;for(j=0;j #include fun(int x) {if(x/2>0)fun(x/2) printf(%d,x%2); } main() {fun(20);putchar(' ');} #include int b=2; int fun(int*k) { b=*k+b;return(b);} main() {int a[10]={1,2,3,4,5,6,7,8}#include int b=2; int fun(int*k) { b=*k+b;return(b);} main() {int a[10]={1,2,3,4,5,6,7,8},i;for(i=2;i #include sub(int *a,int n,int k) { if(k