typedef int ElemType;
typedef struct _ListNode{
ElemType val;
struct _ListNode *next;
}*ListNode;
void rangdelete(ListNode*head,ElemType min,ElemType max)//head为二级指针,传值的时候传head的地址
{
ListNode Cur = *head, tmp;
if (min > max) return;
while (Cur)
{
if (Cur->val < min)
{
tmp = Cur->next;
if (Cur == *head)
{
*head = tmp;
}
free(Cur);
Cur = tmp;
}else if (Cur->val > max)
{
while (Cur)
{
tmp = Cur->next;
if (Cur == *head)
{
*head = tmp;
}
free(Cur);
Cur = tmp;
}
}else
{
Cur = Cur->next;
}
}
}