有以下程序 #include <stdio.h> #define f(x) x*x*x main() { int a=3,s,t ; s=f(a+1); t=f((a+1)); printf("%d,%d\n",s,t); } 程序运行后的输出结果是

admin2020-07-28  24

问题 有以下程序
#include <stdio.h>
#define f(x) x*x*x
main() {
int a=3,s,t ;
s=f(a+1);
t=f((a+1));
printf("%d,%d\n",s,t); }
程序运行后的输出结果是

选项 A、10,10
B、10,64
C、64,10
D、64,64

答案B

解析 根据题目中宏f(x)的定义,f(a+1)=a+1*a+1*a+1= a+a+a+1=10,而f((a+1))=(a+1)*(a+1)*(a+1)=4*4*4=64。
转载请注明原文地址:https://kaotiyun.com/show/em3p777K
0

最新回复(0)