两数交换(指针)
#include <stdio.h>
void Swap(int *x,int *y);
int main()
{
int a,b;
printf("Enter a,b:");
scanf("%d,%d",&a,&b);
printf("Before swap:a=%d b=%d\n",a,b);
Swap(&a,&b);
printf("After swap:a=%d b=%d\n",a,b);
return 0;
}
void Swap(int *x,int *y)
{
int temp;
temp=*x;
*x=*y;
*y=temp;
}
