ç»ä½ å½æ°èªå·±ä¹å¾ç»ä¹ ååï¼
//é¾è¡¨æéå®ç°
#include<stdio.h>
#include<malloc.h> //éè¦malloc.h
struct node
{
int i;
struct node *pre,*next;
};
struct node head;
void init()//åå§å
{
head.i=0;
head.pre=NULL;
head.next=NULL;
}
struct node *ins(struct node *p,int i) //å¨pä½ç½®åæå
¥i
{
struct node *t;
t=(struct node *)malloc(sizeof(struct node));
t->i=i;
if(p->next!=NULL)
p->next->pre=t;
t->next=p->next;
p->next=t;
t->pre=p;
return t;
}
void del(struct node *p) //å é¤pä½ç½®(p!=head)
{
if(p->next!=NULL)
p->next->pre=p->pre;
p->pre->next=p->next;
free(p);
}
æåºé¨åå¯ä»¥ä½¿ç¨å泡æè
å¿«æï¼éæ
温馨提示:答案为网友推荐,仅供参考