Create 循环单链表基本操作.c

This commit is contained in:
ViolentAyang
2022-03-18 21:01:41 +08:00
committed by GitHub
parent 49e6e976b5
commit 68f9181928

View File

@@ -0,0 +1,35 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
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;
}
}