Just to be sure...

1
2
3
4
   free(p);
   return;
   delete p;
   p = NULL;


When the student who wrote this was asked, he explained the reasoning:

"First, there was only the free and p=NULL. But then I thought maybe I insert the delete, just to be sure the memory gets deleted, But it didn't worked, so I tried a bit and the return helped make it working again."

Ciao, Imi.
PS: A friend's story.. but still funny enough :)
The almighty return keyword works its magic powers once again! Amazing how it can make the most complicated of programs finish without any problems... Almost like the supernatural exit() function.
Last edited on
For how many minutes had this student been programming?
Last edited on
lol
For how many minutes had this student been programming?

Actually lol'd at that haha
Topic archived. No new replies allowed.