#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函數(shù)的區(qū)別 麻煩講下地址那會事兒 謝謝
c++ 地址 swap函數(shù)?
幕布斯7119047
2019-02-07 10:06:09