从C ++数组元素删除 [英] Delete element from C++ array

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

问题描述

请告诉我如何从C删除元素++数组。

Please tell me how to delete an element from a C++ array.

我的老师是其值设置为0,是正确的?

My teacher is setting its value to 0, is that correct?

推荐答案

您真的不能从C删除的元素++数组。

You can't really "delete" an element from a C++ array.

但是,如果阵列由指针,你可以删除对象,特定元素点。

However, if the array consists of pointers, you can delete the object that a specific element points to.

在你的老师的情况下,这将是重要的是要注意是否数组的对象是动态分配的(使用 C ++操作符)或没有。他可能只是作为一个指标,该值就不再有效了值设置为 0

In your teacher's case, it will be important to make note of whether the objects of the array are dynamically allocated (using the new operator in C++) or not. He may simply be setting his values to 0 as an indicator that the value is no longer valid.

如果没有实际的源$ C ​​$ C,这就像我可以帮你。

Without actual source code, this is as much as I can help you with.

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

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