gpt4 book ai didi

c++ - 如何在C++中删除一个char*数组

转载 作者:行者123 更新时间:2023-11-30 05:08:16 25 4
gpt4 key购买 nike

我在网上四处寻找这个,但没有找到答案。如果我的类(class)有一个这样声明的 protected 成员:char * arr[3] = {"Blah", "Blah", "Blah"}我需要在析构函数中删除这个成员吗?如果是这样,正确的语法是什么?谢谢!

最佳答案

Would I need to delete this member in the destructor?

没有。

当然还有:

I can’t use the string class, it’s a programming assignment and they want all strings to be stored as char*

这是 C++ 赋值中一个非常愚蠢的限制。

关于c++ - 如何在C++中删除一个char*数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46943086/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com