单选题
C语言
题号 #2268713
有以下程序:
#includedstdi0.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
答案解析
本题考查带参数的宏定义。第一次函数调用求S的值,x=a+1,所以X*X*X应写成a+1*a+1*a+1,没有括号优先级,结果为l0,第二次函数调用x*X*X可写成(a+1)*(a+1)*(a+1), 所以结果为43=64。
你可能感兴趣的试题
A.struct ord{int x;int Y;int Z;};struet ord a;
B.struct ord{int x;int y;int Z;}struct ord a;
C.struct ord{int X;int Y;int Z;}a;
D.struct{int X;int y;int Z;}a;
A.char str[]="string";c=str;
B.scanf(%s,c):
C.c=getchar( );
D.*c="strin9";
A.1001,ZhangDa,1098.0
B.1002,ZhangDa,1202.0
C.1001,ChangRong,1098.0
D.1002,ChangRong,1202.0