定义:每个数据结点都有两个指针,分别指向直接后继和直接前驱,结构特点如下
指针域 | 数据域 | 指针域 |
---|---|---|
prior | data | next |
prior | data1 | next | prior | data2 | next | prior | data3 | next | NULL |
定义:
typedef int Type
typedef struct _DListNode{
struct _DListNode *prior;
struct _DListNode *next;
Type data;
void* data1;
}DListNode;
各种可能的操作
//操作双链表
static DListNode *create(void);
static int find(DListNode *dlist,Type find_data);
static DListNode *change(DListNode *dlist,int pos,Type data);
static DListNode *insert(DListNode *dlist,Type data,int pos);
static DListNode *delete(DListNode *dlist,Type data);
static void display(DListNode *list);
创建双链表
static DListNode *create(void){
DListNode *node = (DListNode*)malloc(sizeof(DListNode));
node->prior = NULL;
node->next = NULL;
node->data = list[0];
}
来源:CSDN
作者:楼兰公子
链接:https://blog.csdn.net/nh5431313/article/details/104789708