dynamically allocated string arrays failed to be deallocated

前端 未结 2 622
萌比男神i
萌比男神i 2020-12-21 14:01

I have the following piece of code:

string * p = new string[8];
cout<

which seems ok to me but failed

2条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-21 14:58

    Yap. new [] pairs with delete []. free()ing causes undefined behavior.

提交回复
热议问题