swap

代码
#include <iostream>
using namespace std;
void swap(int *i,int *j)
{
    
int temp = *i;
    
*= *j;
    
*= temp;

}
void swap2(int &i,int &j)
{
    
int temp = i;
    i 
= j;
    j 
= temp;
}
int main()
{
    
int a = 10,b = 20;
    swap(a,b);
    cout
<<a<<" "<<b<<endl;
    swap2(a,b);
    cout
<<a<<" "<<b<<endl;
    
return 0;

}
原文地址:https://www.cnblogs.com/ManMonth/p/1817360.html