swap2函数不输出,为什么?
#include<stdio.h>void swap1(int x,int y);
void swap2(int *x,int *y);
int main()
{
int a,b;
printf("please input a=:");
scanf("%d",&a);
printf("\n b=:");
scanf("%d",&b);
swap1(&a,&b);
printf("\nafter call swap1:a=%d b=%d\n",a,b);
swap2(a,b);
printf("\nafter call swap2:a=%d b=%d\n",a,b);
return 0;
}
void swap1(int x,int y)
{
int temp;
temp=x;
x=y;
y=temp;
}
void swap2(int *x,int *y)
{
int temp;
temp=*x;
*x=*y;
*y=temp;
}