My IDE is Code::Blocks. I am in debug mode, I click on the "red play button" for Debug / Continue and my code runs fine. Then, always in debug mode, I click on the "green play button" for Run and my code crashes. Any ideas on why this happens? How can I find the bug in my code if clicking on Debug / Continue everything runs fine? I cannot include a copy of my code because it is too long.
After a trial and error debugging, I discovered that the program crashes when I use "delete[]" to deallocate the memory block pointed to by a pointer allocated with "new". Strange thing is that this dynamic allocation and deallocation is in a for loop, and the program crashes after a few loops, so not right at the beginning.
Thanks for any suggestions you may have.
EDIT: Allocation is with "new[]". I cannot paste the code because it is too long. The same allocation and deallocation is used in my code for other pointers without problems, but apparently only some of them cause the code to crash when deallocated. How can I debug if when I click on "Debug / Continue" the program does not crash but it crashes when I click on "Run"?