一、问题
在c++学习时遇到函数,这里的&表示什么意思呢?
void TcpCongestionOps (const TcpCongestionOps &other) {
}
二、示例代码
#include<iostream>
using namespace std;
void swap1(int aii,int bii)
{
int cii=aii;
aii=bii;
bii=cii;
}
void swap2(int &aii,int &bii)
{
int cii=aii;
aii=bii;
bii=cii;
}
int main ()
{
int a=1;
int b=2;
swap1(a,b);
printf("%d %d\n",a,b);
swap2(a,b);
printf("%d %d\n",a,b);
return 0;
}
示例输出: