1.宏实现两数最大值
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#define MAX (a>b)?a:b
int main()
{
int a = 10;
int b = 5;
int z = MAX;
printf("Max=%d\n",z);
system("pause");
return 0;
}
#include<stdio.h>
#define MYSWAP(num) (((num&0x55555555)<<1)|(num&0xaaaaaaaa)>>1)
int main()
{
int num=0;
scanf("%d",&num);
printf("%d\n",MYSWAP(num));
return 0;
}