C利用宏定义写一些小函数

求最大值、求余数:

 1 #include <stdio.h>
 2 
 3 #define SURPLUS(A,B) ((A)%(B)) 
 4 #define max(A,B) (A>B ? A:B)
 5 
 6 main()
 7 {
 8     printf("%d\n",max(2,3));
 9     //getch();
10     return 0;
11 }

 

posted @ 2015-02-28 13:52  永久指针  阅读(495)  评论(0编辑  收藏  举报