c++ - Why isn't my pointer NULL? -
i have linked list of families. delete 1 of childs siblings so.
p->mywife->mychildren=p->mywife->mychildren->mysibling; //makes sibling child list not broken when deleting delete p->mywife->mychildren->mysibling;
and later print child/siblings attributes based upon this
if(p->mywife->mychildren->mysibling!=null){ print childs attributes }
whenever print though, prints weird number sibling (im assuming memory address) need make pointer null?
deleting pointer doesn't set zero. deallocates memory being pointed pointer. set null have set null yourself.
p->mywife->mychildren->mysibling = null /*defined 0 */;
Comments
Post a Comment