Is it necessary to call delete[] vs delete for char arrays?

前端 未结 3 2032

I\'m utilizing a library written by a collegue and discovered that valgrind was spewing out errors related to the delete.

The problem was t

3条回答
  •  误落风尘
    2021-01-12 08:36

    If you allocate an array using new[], you have to destroy it using delete[]. In general, the functions operator delete(void*) and operator delete[](void*) aren't guaranteed to be the same.

    Refer here

提交回复
热议问题