引用
a、类型名 & 引用名=变量名
intn=4;
int& r=n;
b、引用可以作为函数返回值(不明觉厉)
#include <iostream>
using namespace std;
int n=4;
int & SetValue(){ return n;}
int main()
{
SetValue()=40;
cout<<n;
return0;
}
a、类型名 & 引用名=变量名
intn=4;
int& r=n;
b、引用可以作为函数返回值(不明觉厉)
#include <iostream>
using namespace std;
int n=4;
int & SetValue(){ return n;}
int main()
{
SetValue()=40;
cout<<n;
return0;
}