问题 单项选择题

有如下程序:
#include <stdio.h>
int func(int a,int b)
return(a+b):
main()
int x=2,y=5,z=8,r;
r=func(func(x,y),z);
printf("%d\n",r);

该程序的输出结果是( )。

A.12

B.13

C.14

D.15

答案

参考答案:D

解析: 在表达式r=func(func(x,y),z)中,func(x,y)是第一次调用函数,它的返回值7作为func函数第二次调用的实参,结果为15。

填空题
问答题 简答题