#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define MYADD(x,y) ((x) + (y))
void test01()
{
int a = 10;
int b = 20;
int ret = MYADD(a, b) * 50 ; // ((10) + (20)) * 50
printf("ret = %d\n", ret);
}
int main(){
test01();
system("pause");
return EXIT_SUCCESS;
}
测试结果
#include<stdio.h>#define CH(a,b) \
do{ \
a = a + b;\
b = a - b;\
a = a - b;\
}while(0) intmain(int argc,constchar*argv[]){int a =10, b =5;CH(a,b);printf("a:%d,b:%d\n",a,b);return0;}