对函数的引用:
using namespace std;
const int MAX = 2e5 + 5;
int &f(int &i) {
int &j = i;
i+=10;
return j;
}
int main()
{
int k = 0;
int &m = f(k);
cout << k << endl;
m=20;
cout << k << endl;
return 0 ;
}
比如这段代码,输出10,20。这也告诉我们。。。。引用其实就是 公用统一块空间地址,所以在 返回引用的函数 中 不允许 return i+1; 这样的东西出现,因为他必须是一个变量才可以!!!