1. 程式人生 > >第十七次發博不知道用什麽標題好

第十七次發博不知道用什麽標題好

size 標題 data next node ide typedef list alloc

雙向鏈表的插入

typedef struct node{

  Elemtype data;

  struct nide *prior;

  struct node *next;

}Dlist;

int insElem(Dlist *L,Elemtype x,int i){

  int j=0;

  Dlist *p,*s;

  *p=L;

  if(p==NULL) return 0;

  else {

      s=(Dlist *)malloc(sizeof(Dlist));

      s->data=x;  

      s->next=p->next;     //①

      if(p->next==NULL)

        p->next->prior=s;  //②

        s->prior=p;     //③

        p->next=s;     //④

        return 1;

    }

}

第十七次發博不知道用什麽標題好