| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 595 人关注过本帖
标题:删除节点(链表)
只看楼主 加入收藏
飞扬白鸽
Rank: 1
等 级:新手上路
帖 子:108
专家分:0
注 册:2005-12-31
收藏
 问题点数:0 回复次数:1 
删除节点(链表)
删除最后一个节点:
person *current1 , *current2 ;
current1 = head ;
current2 = current -> next ;
while ( current2 -> next != NULL )
{
current1 = current2 ;
current2 = current1 -> next ;
}
free ( current1 -> next ) ;
current1 -> next = null ;
if ( head == current1 )
head = null ;

哪位学友解释一下这些代码?今天刚弄懂了插入节点,现在删除节点又迷糊了。。。
搜索更多相关主题的帖子: 链表 节点 next head 删除 
2006-02-13 19:38
aiyuheng
Rank: 1
等 级:新手上路
威 望:1
帖 子:656
专家分:0
注 册:2006-1-12
收藏
得分:0 
将要删除的节点释放,然后指针指向下一个.不知道你哪里不明白啊?

when i want to ask anyone,i will ask myself first.
2006-02-13 19:57
快速回复:删除节点(链表)
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014265 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved