Delete in middle of array
What is the result of the following:
char* str = new char;
delete  &str;
does it delete the whole array? or only half of it?
It's undefined behavior. It will likely corrupt your memory, crash your program or do nothing.
damn I don't like any of that...
Thanks for the answer!
Last edited on
No. Do not do this, it is undefined behavior.
Always, always, ALWAYS use delete for every new.
char *str = new char
This methodology the ONLY proper way to use delete.
Topic archived. No new replies allowed.