0

why is it that in this code when I use the delete operator the array still has a value and the value is not 0

https://code.sololearn.com/cU6KGbpZEpeI/?ref=app

24th Jul 2020, 12:03 PM
Emmanuel Abraham
2 Réponses
+ 4
`delete` here meant to tell the big boss (operating system) that your program no longer need that block of memory, and big boss can then re-offer that block to be used by another program. But it isn't necessary that you cleanup the block (zero fill the block). It's as if when you rent an apartment, you may have some of your stuffs left in there when you leave the apartment. There's no obligation for you to make sure that the apartment is clean for the next people to live in. All that is required of you is to state that you will no longer extend your stay, which is done by informing the building management. In code, that is the `delete` statement.
24th Jul 2020, 12:46 PM
Ipang
+ 2
Additionally to what Ipang already explained, you may also refer to some of the following threads, which contain similar problems/ topics. Please remember to use the search bar before opening a new thread next time, thanks in advance. https://www.sololearn.com/discuss/685561/?ref=app https://www.sololearn.com/discuss/2209606/?ref=app https://www.sololearn.com/discuss/541715/?ref=app https://www.sololearn.com/discuss/1236265/?ref=app
24th Jul 2020, 12:50 PM
Shadow
Shadow - avatar