Allocating memory using new returns same memory address

后端 未结 5 793
清酒与你
清酒与你 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条回答
  •  面向向阳花
    2021-01-21 09:15

    it is because you are deleting the pointers.do not delete them you will see the difference.

    abc *A = new abc ;
    abc *B = new abc ;
    

提交回复
热议问题