Alright so I've written a function that returns a pointer to a char array on the heap. So my code looks something like this char *ptr = func("This is the argument being allocated to the heap"); . Then later when I call delete[], only 1 word (four bytes) are being deleted. The rest stays on the heap and I can't figure out what is wrong with it. Any help would be appreciated
I used gdb to check this. But I was just being stupid. I assumed that because the first four bytes were 0 after they were all deleted, I assumed that this meant ONLY those bytes were deleted... duh! Haha Thanks!