jeudi 24 octobre 2019

How does deleting a vector value directly cause a memory leak?

I have two scenarios

Object* obj = Vector[0];
delete obj;

Versus

delete Vector[0];

I’m told the later causes memory leak and array out of bounds. How? Doesn’t both methods point to the same pointer?

Aucun commentaire:

Enregistrer un commentaire