#include <iostream>
void swap1(int a, int b){
int tmp = a;
a =b;
b=tmp;
}
void swap2(int &a, int & b){
int tmp = a;
a =b;
b=tmp;
}
int main(){
int a =1;
int b= 2;
std::cout<< a << " " << b << std::endl;
swap1 ( a, b);
std::cout << a << " " << b << std::endl;
swap2 (a, b);
std::cout << a << " " << b << std::endl;
}
求问 两swap函数的区别 麻烦讲下地址那会事儿 谢谢
缥缈止盈