下面是我的代码
#include
#include
using namespace std;
int * func()
{
int *p = new int (10);
cout << p << endl;
return p;
}
void test01()
{
int *p = func();
cout << *p << endl;
cout << p << endl;
delete p;
cout << *p << endl;
cout << p << endl;
}
int main()
{
test01();
return 0;
}
下面运行结果
0x781150
10
0x781150
10
0x781150
Process returned 0 (0x0) execution time : 0.124 s
Press any key to continue.
希望有大佬帮忙解答。。。。