有以下程序 #include #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); } 程序运行后的输出结果是( )。

admin2019-12-17  24

问题 有以下程序
#include
#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,64
B、10,10
C、64,10
D、64,64

答案A

解析 宏替换只是使用宏名代替一个字符串,是一种机械的置换,所以表达式s=f(a+1)=a+1*a+1*a+1=10,t=f((a+1))=(a+1)*(a+1)*(a+1)=64,答案选A。
转载请注明原文地址:https://kaotiyun.com/show/9zCp777K
0

随机试题
最新回复(0)