If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

_BLOCK_TYPE_IS_VALID(pHead->(nBlockUse) debug assertion error

EDIT: NEVER MIND, I totally blanked out and didn't realize that I was actually trying to delete an array that WASN"T created on the heap! IGNORE -> I can't figure out why I'm getting a _BLOCK_TYPE_IS_VALID debug assertion error. It's associated with the last line of code that deletes memory created on the heap. The program adds 2 to the ptr pointer, subscripts it with ptr[0], displays the value, then subtracts 2 to get the pointer back to the beginning of the array, and attempts to free the memory. But I get the error.

Re: _BLOCK_TYPE_IS_VALID(pHead->(nBlockUse) debug assertion error

This gives a memory leak as the memory address initially stored in ptr from the new is overwritten to be the address of intArray.

All advice is offered in good faith only. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/