Array of structs and new / delete

后端 未结 8 896
没有蜡笔的小新
没有蜡笔的小新 2021-01-02 18:47

I have a struct like this:

class Items 
{
private:
    struct item
    {
        unsigned int a, b, c;
    };
    item* items[MAX_ITEMS];
}

8条回答
  •  长发绾君心
    2021-01-02 19:22

    C++ isn't my strong suit, but I'm pretty sure you'd be leaking the memory if you set the pointer to NULL.

    EDIT: The memory being leaked would be the memory being pointed to by the pointer in the array.

提交回复
热议问题