#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define N 3
#define exchange(a, b) {int tmp = a; a = b; b = tmp;}
void func(int a, int b)
{
exchange(a, b);
}
void main()
{
int a = 10, b = 5;
exchange(a, b);
printf("a=%d, b=%d\n", a, b);
a = 10, b = 5;
func(a, b);
printf("a=%d, b=%d\n", a, b);
return 0;
}
/*
a=5, b=10
a=10, b=5
Process returned 10 (0xA) execution time : 0.088 s
Press any key to continue.
*/
【C 语言练习】使用宏定义形式完成两个数字交换
最新推荐文章于 2024-01-21 20:00:55 发布