Segfault when deleting pointer

后端 未结 5 1532
南笙
南笙 2021-01-03 12:32

I\'ve been experiencing segfaults when running some C++ code. I\'ve isolated the problem to a line in the program that deletes a pointer. Here\'s a simple example that pro

5条回答
  •  情歌与酒
    2021-01-03 13:11

    You can't use delete on anything you didn't get with new. Trying to do so will cause undefined behaviour. Your program crashed, but anything could have happened.

提交回复
热议问题