我用指针来进行两个数交换,怎么就是出现错误,求指点??
#include<iostream>using namespace std;
int swap(int *,int *);
int main()
{
int *a,*b;
int x,y;
while (cin>>x>>y)
{
a=&x; b=&y;
swap(a,b);
cout<<*a<<" "<<*b<<endl;
}
}
int swap(int *a,int *b)
{
int *temp;
temp=a;
a=b;
b=temp;
}