本文介绍了指针数组删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
确实删除[]一个
,其中 A
是指针的动态分配的数组,执行删除
在阵列中的每个指针?
Does delete[] a
, where a
is dynamic-allocated array of pointers, execute delete
for each pointer in array?
我想,这与用户定义的类阵列执行析构函数,但做什么用的指针发生了什么?
I suppose, it executes destructor for arrays with user-defined classes, but what's happening with pointers?
推荐答案
没有,删除[]
用来删除阵列。如果您需要删除数组元素,你需要调用删除
对他们每个人。
No, delete []
is used to delete an array. If you need to delete array elements, you need to call delete
on each one of them.
这篇关于指针数组删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!