how to properly delete a pointer to array

后端 未结 6 2081
无人共我
无人共我 2020-12-03 15:29

I\'m new to C++, and I\'m confused about arrays and pointers. Could someone tell me how I can properly delete a pointer. Like for example,

int *foo;
foo = ne         


        
6条回答
  •  眼角桃花
    2020-12-03 15:46

    If you do new [] you must do delete []. It's a simple enough rule, and worth remembering.

提交回复
热议问题