阅读以下程序,a的值为#include<stdio.h>int a;int f1(int b, int c, int d);int f2(int b, int c);int f3(int b);int f1(int b, int c, int d) { return f2(b*c, d);}int f2(int b, int c) { return f3(b*c);}int f3(int b) { a = b; return a == 32;}int main() { int b = 2, c = 4, d = 8, ans; a = 1; ans = f1(b, c, d); return 0;}
A: 1
B: 2
C: 32
D: 64
A: 1
B: 2
C: 32
D: 64
举一反三
- 中国大学MOOC: 以下程序调用函数的顺序为()#include<stdio.h>int f1(int a, int b);int f2(int a, int b);int f3(int a, int b);int f4(int a, int b);int main() { int a, b,ans; a = 1; b = 2; ans = f1(a, b);}int f1(int a, int b) { return f2(a,b);}int f2(int a, int b) { if (a>b) return f3(a, b); return f4(a, b);}int f3(int a, int b) { return a - b;}int f4(int a, int b) { return b - a;}
- 以下程序调用函数的顺序为()#include[stdio.h]int f1(int a, int b);int f2(int a, int b);int f3(int a, int b);int f4(int a, int b);int main() { int a, b,ans; a = 1; b = 2; ans = f1(a, b);}int f1(int a, int b) { return f2(a,b);}int f2(int a, int b) { if (a>b) return f3(a, b); return f4(a, b);}int f3(int a, int b) { return a - b;}int f4(int a, int b) { return b - a;} A: f1->f2->f3->f4 B: f1->f2->f3 C: f1->f2->f4 D: f4->f3->f2->f1
- 下面程序的运行结果是_______。#include<stdio.h>int main( ){ int f1( int x , int y ) ;int a = 11 , b = 12 ,c ;c = f1( a , b ) ;printf( "a=%d,b=%d,c=%d\n" , a , b ,c ) ;return 0 ;}int f1( int x , int y ){ int f2( int , int ) ;int c ;x = x * 2 ;y = y * 2 ;c = f2( x , y ) ;return c*2 ;} int f2( int a , int b ){int c ;c = ( a + b ) % 3 ;return c ;}
- 下列程序的运行结果是?#include [stdio.h] int f(int n); int main() { printf("%d\n", f(f(f(f(1))))); return 0; } int f(int n) { return n + 1; } A: 5 B: 4 C: 3 D: 2
- 有以下程序 int f1(int x,int y) {return x>y?x:y;} int f2(int x,int y) {return x>y?y:x;} main() { int a=4,b=3,c=5,d=2,e,f,g; e=f2(f1(a,b),f1(c,d)); f=f1(f2(a,b),f2(c,d)); g=a+b+c+d-e-f; printf("%d,%d%d\n",e,f,g); } 程序运行后的输出结果是()