#include <stdio.h>
//定一个宏求三个数的最大值
#define THREEMAX(a,b,c) (a>b?a:b)>c?(a>b?a:b):c
//定义一个宏让两个数进行交换
#define C(a,b) a=a+b;b=a-b;a=a-b
int main(){
int a = 10, b = 13,c = 9;
C(a,b);
printf("a=%d\nb=%d\n",a,b);
THREEMAX(a,b,c);
printf("%d\n",THREEMAX(a,b,c));
return 0;
} |
|