c语言 8-3

1、

#include <stdio.h>

#define swap(type, x, y) type tmp = x; x = y; y = tmp;

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

 

posted @ 2021-05-24 18:39  小鲨鱼2018  阅读(48)  评论(0编辑  收藏  举报