//链表结构typedef struct DulNode{ DataType data; //数据 struct DulNode *prior; //指向前一个节点的指针 struct DulNode *next; //指向后一个节点的指针}DulNode;//双向链表初始化void InitList(DulNode **h){ (*h) = NULL;}//尾插void PushBack(DulNode *h,DataType x){ DulNode *p; DulNode *q = h; p = (DulNode*)malloc(sizeof(DulNode)); if(p == NULL) { printf("Memory is false"); return; } p->data = x; q->next = p; p->prior = q; p->next = NULL; q = p;}//双向连表的插入//void PushBack(DulLinkList h,int pos,DataType x)//{// DulLinkList p = h->next,q;// int i = 0;// while(p != h && i < pos-1)// {// p = p->next;// i++;// }// if( p == h && i > pos - 1)// {// printf("插入位置不合法\n");// return;// }// q = (DulLinkList)malloc(sizeof(DulNode));// if(q == NULL)// {// printf("Memory is false");// return;// }// q->data = x;// q->prior = p->prior;// p->prior->next = q;// q->next = p;// p->prior = q;//}//打印void Print(){ DulNode *h; DulNode *p; InitList(&h); p = h->next; while(p) { printf("%d->",p->data); p = p->next; } printf("NULL");}