问题
单项选择题
有以下程序
#include<stdio.h>
int fun(int x, int y)
if(x!=y) return ((x+y)/2);
else return (x);
main()
( int a=4, b=5, c=6;
printf("%d\n", fun(2*a, fun(b,c)));
程序运行后的输出结果是______。
A) 3
B) 6
C) 8
D) 12
答案
参考答案:B
解析: 本题考查的是函数的嵌套调用。当fun(2*a, fun(b, c))中2*a为8时,fun(b, c)执行完结果为5,所以fun(2*a, fun(b, c))执行结果为6。