【发布时间】:2011-08-22 23:28:15
【问题描述】:
我有一个家庭的链接列表。我像这样删除了其中一个孩子的兄弟姐妹。
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
}
每当我打印时,它都会为兄弟打印一个奇怪的数字(我假设它是一个内存地址)我需要做什么才能使该指针为空?
【问题讨论】: