宏定义与使用实例

#include <stdio.h>

int f1(int a, int b)
{
    #define _MIN_(a,b) ((a)<(b) ? a : b)
    
    return _MIN_(a, b);
}

int f2(int a, int b, int c)
{
    return _MIN_(_MIN_(a,b), c);
}

int main()
{
    printf("%d\n", f1(2, 1));
    printf("%d\n", f2(5, 3, 2));
    
    return 0;
}

posted @ 2016-12-08 18:18  王小波私人定制  阅读(164)  评论(0编辑  收藏  举报
DON'T FORGET TO HAVE FUN