代码:
#include
#define Max(a,b) (a>b?a:b)
int main()
{
printf("%f\n",Max(1.3,2.0)*5);
return 0;
}
运行结果:
10.000000
代码:
#include
#define exchange(a,b) { int t;t=a;a=b;b=t;}//注意放在一行里
int main()
{
int x=10;
int y=20;
printf("x=%d; y=%d\n",x,y);
exchange(x,y);
printf("x=%d; y=%d\n",x,y);
return 0;
}
运行结果:
x=10; y=20
x=20; y=10