int f(int a, b){int s;s = a + b;return s;}
举一反三
- #include int f(int t[],int n); main() {int a[4]={1,2,3,4},s; s=f(a,4); printf(“%d”,s); } int f(int t[],int n) {if (n>0) return t[n-1]+f(t,n-1); else return 0;} 程序运行后的输出结果是
- 下面程序的输出结果是_______。 #include int function(int a, int b); int main(void) { int x=5, y=3, s; s = function(x, y); printf("%d", s); return 0; } int function(int a, int b) { return a*a - b*b; }
- 下列程序的输出结果是( )。 # include int f(int n) { static int k, s; n--; for(k=n; k>0; k--) s += k; return s; } int main(void) { int k; k=f(3); printf("(%d,%d)", k, f(k)); return 0; }
- 下列程序的输出结果是 。#includeint f(int t[], int n);void 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);}
- 以下程序的输出结果是______。#include [stdio.h]int f(int a[ ],int n){ if(n>1)return a[0]+f(&a[1],n-1);else return a[0];}int main(){ int aa[3]={1,2,3},s;s=f(&aa[0],3);printf(“%d\n”,s);return 0; }