Allocating memory using new returns same memory address

后端 未结 5 785
清酒与你
清酒与你 2021-01-21 08:38
class abc  {
    int x ;
};
int main()
{
    abc *A = new abc ;
    cout<< static_cast(A) << endl ;
    delete A ;
    cout<< static_cast&         


        
5条回答
  •  -上瘾入骨i
    2021-01-21 09:40

    Memory you freed is not used anymore. Memory manager can use the heap as it wants - allocating next free space - the one you actually freed just before.

提交回复
热议问题