C语言实现双向链表(DoublyLinkedList)
#ifndef DOUBLY_LINKED_LIST #define DOUBLY_LINKED_LIST #include<stdio.h> #include<stdlib.h> #include<memory.h> /*链表节点*/ typedef struct DoublyLinkedListNodeS{ struct DoublyLinkedListNodeS *prev,*next; }DoublyLinkedListNode; typedef struct DoublyLinkedList{ DoublyLinkedListNode root;//sentinel list element, only &root, root.prev, and root.next are used int length; }DoublyLinkedList; //初始化双向链表 DoublyLinkedList* DoublyLinkedList_Init(); //销毁链表 void DoublyLinkedList_Destory(DoublyLinkedList* list); //链表长度 int DoublyLinkedList_Len(DoublyLinkedList* list); //求头节点 DoublyLinkedListNode* DoublyLinkedList