mirror of
https://github.com/ViolentAyang/DataStructureC.git
synced 2026-02-03 02:13:14 +08:00
Create 创建不带头结点的单链表.c
This commit is contained in:
37
创建不带头结点的单链表.c
Normal file
37
创建不带头结点的单链表.c
Normal file
@@ -0,0 +1,37 @@
|
||||
#include<stdio.h>
|
||||
#include<stdlib.h>
|
||||
#include<stdbool.h>
|
||||
#define MaxSize 10
|
||||
|
||||
typedef struct LNode{
|
||||
int data;
|
||||
struct LNode *next;
|
||||
}LNode,*LinkList;
|
||||
|
||||
bool InitList(LinkList *L){
|
||||
*L = NULL;
|
||||
return true;
|
||||
}
|
||||
bool Empty(LinkList L){
|
||||
if(L==NULL){
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
bool Empty(LinkList L){
|
||||
return (L==NULL);
|
||||
}
|
||||
*/
|
||||
int main(){
|
||||
LinkList L;
|
||||
InitList(&L);
|
||||
if(Empty(L)){
|
||||
printf("创建了一个空表");
|
||||
}else{
|
||||
printf("该表不为空");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user