-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathModifyIndex.c
48 lines (39 loc) · 1002 Bytes
/
ModifyIndex.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
* @Description: 这是一个删除链表中子链节点的函数
* @Author: Xiao ZhiPeng
* @Version: 1.0
* @InterFace:
* @Date: 2021-11-12 20:17:44
* @LastEditors: Xiao ZhiPeng
* @LastEditTime: 2021-11-12 21:27:22
*/
#include "ResultTB.h"
status ModifyIndex(QMminterms *index , QMminterms *pterms)
{
QMminterms *p = index , *ptr = pterms , *ptemp = NULL ;
while(ptr)
{
if (ptr->data.flag == 1)
{
ptr = ptr->next ;
continue ;
}
if (ptr->data.value > p->next->data.value )
{
p = p->next ;
}
else if (ptr->data.value < p->next->data.value)
{
ptr = ptr->next ;
}
else
{
ptemp = p->next ;
p->next = ptemp->next ;
free(ptemp) ;
ptr = ptr->next ;
}
if (!p->next) break ;
}
return 0 ;
}