From 68f918192812fc68d4380bb3350313575b341c45 Mon Sep 17 00:00:00 2001 From: ViolentAyang <76544389+ViolentAyang@users.noreply.github.com> Date: Fri, 18 Mar 2022 21:01:41 +0800 Subject: [PATCH] =?UTF-8?q?Create=20=E5=BE=AA=E7=8E=AF=E5=8D=95=E9=93=BE?= =?UTF-8?q?=E8=A1=A8=E5=9F=BA=E6=9C=AC=E6=93=8D=E4=BD=9C.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 链表/循环单链表基本操作.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 链表/循环单链表基本操作.c diff --git a/链表/循环单链表基本操作.c b/链表/循环单链表基本操作.c new file mode 100644 index 0000000..7935fe0 --- /dev/null +++ b/链表/循环单链表基本操作.c @@ -0,0 +1,35 @@ +#include +#include +#include + +typedef struct DNode{ + int data; + struct DNode *next; +}LNode,*LinkList; + +bool InitList(LinkList L){ + L = (LinkList)malloc(sizeof(LNode)); + if(!L){ + return false; + } + L->next = L; + return true; +} +//判断链表是否为空 +bool isEmpty(LinkList L){ + if(!L->next){ + return true; + } + else{ + return false; + } +} +//判断结点p是否为循环链表的表尾结点 +bool isTail(LinkList L,LNode *p){ + if(p->next==L){ + return true; + } + else{ + return false; + } +}