数据结构双链表的插入和删除有问题了,求大佬看看

void insert(double price, int number,int time,char* name,int date,int id)
{
movRecord* node = record.next;
movRecord* p = record.next;

while (node != NULL)
{
        if (node->id > id)  break;
        else
        node = node->next;
}
movRecord* tmp = (movRecord *)malloc(sizeof(movRecord));
tmp->id = id;
tmp->date = date;
strcpy(tmp->name,name);
tmp->time = time;
tmp->number = number;
tmp->price = price;   
    if( id<10)
{

node->prior->next= tmp;
tmp->prior=node->prior;
tmp->next = node;
node->prior=tmp;
}
 else
{     
node->prior->next=tmp;
tmp->prior=node;
tmp->next=NULL;

}

while(p!=NULL)
{
    printf("电影编号:%3d\t放映日期:%10d\t电影名:%5s\t场次:%2d\t票数量:%4d\t票价:%5.2lf\t\n", 
    p->id, p->date,p->name,p->time,p->number,p->price);
    p=p->next;
}

}

void delete(int id)
{
movRecord* node = record.next;
movRecord* p=record.next;
while (node != NULL && node->id != id)
{
node = node->next;
}
if (node)
{
node->prior->next = node->next;
node->next->prior = node->prior;
free(node);
}

else
    printf("无法找到该文件\n");  

while(p!=NULL)
{
    printf("电影编号:%3d\t放映日期:%10d\t电影名:%5s\t场次:%2d\t票数量:%4d\t票价:%5.2lf\t\n",
     p->id, p->date,p->name,p->time,p->number,p->price);
    p=p->next;
}

}

不知道你其他的代码是怎么样子的。头结点和尾节点,在插入和删除的时候,要特殊对待的。