c++ 动态内存分配
程序代码:void main()
{
int * p;
p=new int(8);
cout <<*p<<endl;
// delete p;
p=new int (9);
cout<<*p<<endl;
delete p;
}为什么我分配两次内存空间,最后只是回收了一次,但是编译器不报错说内存泄漏呢?
程序代码:void main()
{
int * p;
p=new int(8);
cout <<*p<<endl;
// delete p;
p=new int (9);
cout<<*p<<endl;
delete p;
}
2012-10-14 16:40
2012-10-14 17:21
2012-10-14 18:01
2012-10-14 19:02
2012-10-14 19:22
2012-10-14 19:35

2012-10-14 21:02
2012-10-15 09:01
2012-10-15 09:26
2012-10-15 09:28