第6章_结构体.pptVIP

  • 3
  • 0
  • 约1.21万字
  • 约 94页
  • 2016-12-28 发布于江苏
  • 举报
4.删除连表 删除连表的可能性操作有: 删除头元素a0 删除尾元素an-1 删除中间某元素ai 如: head a0 ? a1 ? an null a2 ? ?? ? ? ? (1)若是删除头元素a0,则需要执行的语句是: head=a0-next; (2)若是删除尾元素an-1,则需要执行的语句是: an-next=NULL; (3)若是删除中间某元素ai,则可执行的语句是: ai-1-next=ai-next 如要删除a4元素,则为: a3-next=a4-next; 程序实现为: struct stu *delete(struct stu *head,int del_xh) {struct stu *p1,*p2; p1=head; if(p1==NULL) printf(list table null\n); else if(p1-xh==del_xh) head=p1-next; else { while(p1-xh!=del_xh p1-next!=NULL) { p2

文档评论(0)

1亿VIP精品文档

相关文档