我有一个家庭链接列表。我像这样删除了一个孩子的兄弟姐妹。为什么我的指针不是NULL?
p->myWife->myChildren=p->myWife->myChildren->mySibling; //makes the sibling the child so the list is not broken when deleting
delete p->myWife->myChildren->mySibling;
后来我打印基于此
if(p->myWife->myChildren->mySibling!=NULL){
print the childs attributes
}
每当我打印虽然孩子/兄弟姐妹的属性,它打印一个奇怪的号码为兄弟(IM假设它的内存地址)做什么,我需要做的是使该指针为空?
参见:http://stackoverflow.com/questions/704466/why-doesnt-delete-set-the-pointer-to-null – 2011-05-11 04:02:35