c语言 8-3

1、

#include <stdio.h>

#define swap(type, a, b)  {type tmp = a; a = b; b = tmp;}

int main(void)
{
    int x = 5, y = 10;
    printf("initial value   x = %d\n", x);
    printf("initial value   y = %d\n\n\n", y);
    
    swap(int, x, y);
    
    printf("processed value x = %d\n", x);
    printf("processed value y = %d\n", y);
    
    return 0;
}

c语言 8-3

 

上一篇:Python学习总结5:数据类型及转换


下一篇:如何使用设计模式,干掉if-else