这三种有写法是不是等价
#include<iostream>
#include<stdio.h>
using namespace std;
void fun1(int a ,int b )
{
cout<<a<<b;
int c ;
c = a ;
a = b;
b = c;
cout<<a<<b;
}
//引用
void fun2(int &a, int &b)
{
cout<<a<<b;
int c ;
c = a ;
a = b;
b = c;
cout<<a<<b;
}
//指针
void fun(int *a ,int *b)
{
cout<< *a<< *b;
int c;
c = *a;
*a = *b;
*b=c;
cout<< *a<< *b;
}
int main(){
int x =1 ,y =2;
//fun1(x,y);
//fun2(x,y);
fun(&x,&y);
}