指针数组删除 [英] Deleting array of pointers

查看:136
本文介绍了指针数组删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

确实删除[]一个,其中 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.

这篇关于指针数组删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆