Consider the following:
char* msg = new char[20];
msg[4] = '\0';
delete[] msg;
- Did the
delete[] msg
deallocate all the 20 chars allocated formsg
or just those up to the\0
? - If it deallocated only up to the
\0
, how can I force it to delete the entire block of memory?