有关define定义函数所注意的实例

#define SQR(x) x*x

int m=1,k=2;

a=SQR(k+m)/SQR(k+m);

a=k+m*k+m/k+m*k+m;

a=2+1×2+1/2+1×2+1=7.5

 

#define SQR(x) (x)*(x)

int m=1,k=2;

a=SQR(k+m)/SQR(k+m);

a=(k+m)*(k+m)/(k+m)*(k+m);

a=(2+1)*(2+1)/(2+1)*(2+1)=1

 

#define SQR(x)( x*x)

int m=1,k=2;

a=SQR(k+m)/SQR(k+m);

a=(k+m*k+m)/(k+m*k+m);

a=(2+1×2+1)/(2+1×2+1)=1;

posted on 2016-12-21 20:44  么么打123  阅读(95)  评论(0编辑  收藏  举报