本文介绍了我必须在C ++中手动删除struct指针吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人告诉我,我不必手动删除struct指针.
据我了解,您必须delete
用new
分配的所有内容,甚至是结构,对吗?
Somebody told me that I don't necessarily have to delete struct pointer manually.
From what I understand you must delete
everything that is allocated with new
, even structs, right?
推荐答案
对,您必须.与其他所有内容一样,如果您为某些内容分配了内存,则您有责任释放它.
Right, you must.As with everything else, if you allocated memory fore something, you are responsible for releasing it.
这篇关于我必须在C ++中手动删除struct指针吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!