I get this error when I'm attempting to delete an array. I'm new to dynamic arrays, and from what I have learned, arrays must be deleted after use. I plan on using this in a function later on, so deleting the array is a must.
Here's the error message:
HEAP CORRUPTION DETECTED: after Normal block (#154) at 0x007E55A0.
CRT detected that the application wrote to memory after the end of heap buffer.
I know it must be something stupid that I did, but I have very limited knowledge on dynamic arrays.
Increasing size2 in your loop is not going to increase the amount of memory you allocated, so you trample all over memory you don't own, corrupting the heap. If you allocate room for 1 int in the array, you may store 1 int and no more.