//引用做函数返回值 //不能返回局部变量引用 #include<iostream> using namespace std; int& test01() //返回做引用 { int a = 10; return a; } int main() { int &ref = test01(); cout << ref << endl; //cout << ref << endl; 此时返回错误值 system("pause"); return 0; }
引用做函数返回值
猜你喜欢
转载自www.cnblogs.com/gjbhpu0308/p/12469380.html
今日推荐
周排行