#define pingfang(a) (a*a) //这一句是宏定义,用后面括号里(a*a)代替前面pingfang(a)
#include "stdio.h"
int main()
{
int c = pingfang(5+5);//a*a替代pingfang(a),即替代后变为5+5*5+5,因为宏定义只能形式替换,不能计算,所以按照优先级这里应该先算5*5 = 25,再算5+25 = 30,再算 30+5 = 35
printf("c is %d\n", c);//输出结果为35
return 0;
} |