(1)无参宏定义
#define D_SCREEN_LEFT 0
#define D_SCREEN_TOP 0
#define D_SCREEN_RIGHT 1280
#define D_SCREEN_BOTTOM 720
调用示例:
printf("%d*%d\n",D_SCREEN_RIGHT,D_SCREEN_BOTTOM);
(2)带参宏定义
#define SECS_TO_DAYS(secs) ((secs / 3600) / 24) //将秒转换成天
#define MIN(a, b) ((a)<(b)?(a):(b))//取最小值
#define MAX(a, b) ((a)>(b)?(a):(b))//取最大值
调用示例:
printf("%d\n",SECS_TO_DAYS(864000));//10天