#include <stdio.h>
#include <stdlib.h>
typedef struct DuLNode{
int data;
struct DuLNode *prior;
struct DuLNode *next;
}DuLNode, *DuLinkList;
DuLinkList GetElemP_DuL(DuLinkList L, int i);
void CreateList_DuL(DuLinkList &L, int n){
L = (DuLinkList)malloc(sizeof(DuLNode));
L->next = L;
L->prior = L;
DuLinkList p = (DuLinkList)malloc(sizeof(DuLNode));
scanf("%d",&p->data);
p->prior = L;
L->next = p;
L->prior = p;
p->next = L;
for(int i =1; i < n; i++){
DuLinkList p = (DuLinkList)malloc(sizeof(DuLNode));
scanf("%d",&p->data);
p->prior = L;
p->next = L->next;
L->next->prior = p;
L->next = p;
}
}
DuLinkList GetElemP_DuL(DuLinkList L, int i){
DuLinkList p = (DuLinkList)malloc(sizeof(DuLNode));
p = L;
int j = 0;
while(p && j < i){
p = p->next;
++
C语言实现双向链表
最新推荐文章于 2022-10-07 23:57:08 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)