- 2
- 0
- 约1.45万字
- 约 32页
- 2019-06-17 发布于山东
- 举报
* struct node *delete_list(struct node *head,int x) { struct node *p,*q; if(head==NULL) /*1、空表*/ printf(Error! The list is empty.\n); else if(head-num==x) /*2、删首结点*/ head=head-next; else { q=head;p=q-next; for(; p-num!=x p!=NULL; q=p,p=p-next) ; if(p==NULL) /*3、无此结点*/ printf(Error! The numbe is not exsist.\n); else {q-next=p-next; free(p); } /*删除非首结点*/ } return(head); } 1 3 2 head 5 NULL head 1 3 2
原创力文档

文档评论(0)