deleting memory doesn't zero it. It just tells the OS that "this memory is free and you can do whatever you want to it". Between lines 10 and 11, there are many things that could happen, and accessing this memory could very well crash your program. You were just lucky (or not depending on your philosophy) that it printed out the old values. The result is actually undefined.