void erase(Lnode *head, int x, int y)
{
Lnode *p = head -> next;
if(!p) return ;
Lnode *q = head;
while(p)
{
if(p -> data > x && p -> data < y)
{
if(p -> next == NULL)
q -> next = NULL;
else
q -> next = p -> next;
free(p);
p = q -> next;
}
else p = p -> next;
}
}
void deletespan(List *head, Ele x, Ele y)
{
int n = length(head);
List *p = head, *a, *b;
for (int i = 0; i < n; i++)
{
if (p->next->data > x && p->next->data < y)
{
*a = p->next;
p->next = p->next->next;
free(a);
}
else
{
p = p->next;
}
}
}
登录后提交答案