Is delete[] equal to delete?

前端 未结 6 1665
-上瘾入骨i
-上瘾入骨i 2020-11-22 01:05
IP_ADAPTER_INFO *ptr=new IP_ADAPTER_INFO[100];

if I free using

delete ptr;

will it lead to memory leak, if not t

6条回答
  •  一个人的身影
    2020-11-22 01:53

    delete : calls the appropriate destructor only for the element pointed to (if needed), then frees the memory chunk

    delete[] : calls the appropriate destructors for each element in its array (if needed), then frees the memory chunk

提交回复
热议问题