#include<iostream>
using namespace std;
#include<string>
#include<map>
#include<vector>
#include<time.h>
#include <stdlib.h>
#include <stdio.h>
#include <algorithm>
string& test()
{
string s("hello");
return s;
}
int main()
{
string ns;
ns=test();
system("pause");
}
局部变量在运行完毕后 ,会被编译器释放掉,所以,这种函数不合法。
c++中引用和指针的反汇编是一样的