首页明星如下代码运行时报错“CRT detected that the application wrote to the end of heap buffer”,什么问题啊

如下代码运行时报错“CRT detected that the application wrote to the end of heap buffer”,什么问题啊

paiquba 12-14 23次浏览 0条评论

错误原因:

  因为对内存的操作越界了,超出所分配的内存的边界。

  解决方案:

如下代码运行时报错“CRT detected that the application wrote to the end of heap buffer”,什么问题啊

  增大分配的内存。

  e.g.

  ans = new int[size_a size_b 1 ];

  或者加到自己适宜的大小,问题即可解决。

  总结:

  对内存的操作要细之又细,new完后要delete,操作时不要越界(包括向前越或向后越)。

Imogen Heap
求这段话的翻译,谢谢 求这段话的翻译
相关内容
发表评论

游客 回复需填写必要信息