【C练】使用函数实现两个数的交换。

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
void swap(int* x,int* y)
{
	int swap = *x;
	*x = *y;
	*y = swap;
}
int main()
{
	int a = 12;
	int b = 36;
	swap(&a, &b);
	printf("a=%d,b=%d\n", a, b);
	system("pause");
	return 0;
}

猜你喜欢

转载自blog.csdn.net/LXL7868/article/details/88778750