有以下程序 #include #define N 5 #define M N+1 #define f(x)(x*M) main() { int i1,i2; i1=f(2); i2=f(1+1); printf

admin2013-02-23  17

问题 有以下程序
#include  
#define  N  5
#define  M  N+1
#define  f(x)(x*M)
main()
{ int  i1,i2;
  i1=f(2);
  i2=f(1+1);
  printf("%d %d\n",i1,i2);
}
程序的运行结果是

选项 A、12  12
B、11  7       
C、11  11
D、12  7

答案B

解析 根据宏替换的替换规则,我们可知,f(2)=2*N+1=2*5+1=11,f(1+1)=1+1*N+1=1+1*5+1=7。
转载请注明原文地址:https://kaotiyun.com/show/HBJp777K
0

相关试题推荐
最新回复(0)