I keep getting a seg fault and the only thing I'm changing is a pointer "ptr" inside the if statement. I'm wondering if it is not allowed to delete a pointer you are using in an if statement, even though you are redefining it inside the same if statement. Thanks in advanced.
if(ptr == anotherPtr){
delete ptr;
ptr = new Node(...);
}
Aucun commentaire:
Enregistrer un commentaire