#include<stdio.h>#define TRUE 1#define FALSE 0#define PQ(x,y) x*x+y*yint num1=1,num2,num3;void fun1(){int num1=1;static int num2=2;num3+=num1+num2++;printf("in fun1() num1=%d,num2=%d,num3=%d\n",num1,num2,num3);}void main(){num3+=(num2++)-(--num1);printf("in main() num1=%d,num2=%d,num3=%d\n",num1,num2,num3);num1=num2=num3=TRUE;fun1();num1=num2=num3=FALSE;fun1();#ifdef FALSEnum1=1; num2=2;num3=PQ(num1+num2,num1-num2);#elsenum1=3; num2=4;num3=PQ(num1,num2);#endifprintf("in main() num1=%d,num2=%d,num3=%d\n",num1,num2,num3);}
3 回答
饮歌长啸
TA贡献1951条经验 获得超3个赞
#ifdef
#define
等等, 它们都是在预编译的时候完成的,
就是在编译代码之前,
num3=PQ(num1,num2);代码替换为
num3= num1*num2+num1*num2,
然后编译链接运行
- 3 回答
- 0 关注
- 834 浏览
添加回答
举报
0/150
提交
取消