Data structure expriment 1
Classes | Typedefs | Functions
list.h File Reference

静态双向链表的基本定义 More...

#include <stdlib.h>
Include dependency graph for list.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  st_people
 
struct  st_list
 

Typedefs

typedef struct st_people People
 
typedef struct st_list List
 

Functions

Peoplemalloc_l (List *list)
 
void free_l (List *list, People *now)
 
Listinit (int reserve)
 
Listdestroy (List *list)
 
Listcreate_list (int id)
 
Peopleinsert (List *list, People *now, int id)
 
Peopledelete (List *list, People *dying)
 

Detailed Description

静态双向链表的基本定义

Author
emon100

Typedef Documentation

◆ List

typedef struct st_list List

静态双向链表定义

◆ People

typedef struct st_people People

人员节点定义

Function Documentation

◆ create_list()

List* create_list ( int  id)

使用一个整数n创造id从1-n的链表函数

Parameters
[in]id最大人员id
Returns
NULL创建失败,非 NULL 为创建的链表的地址
Here is the call graph for this function:

◆ delete()

People* delete ( List list,
People dying 
)

删除指定位置并返回这个位置的函数

Parameters
list链表
dying要删除的节点
Returns
NULL删除失败或删除到最后一个,非NULL为删除成功
Here is the call graph for this function:

◆ destroy()

List* destroy ( List list)

摧毁链表函数

Parameters
[in]list要摧毁的链表的地址
Returns
NULL失败,非 NULL 摧毁完成的链表的地址

◆ free_l()

void free_l ( List list,
People now 
)

类free(),释放节点的函数

Parameters
[in]list链表
[in]now要删除节点的位置

◆ init()

List* init ( int  reserve)

链表初始化函数

Parameters
[in]reserve整数为最大链表长度预留的位置
Returns
NULL 失败,非 NULL 初始化好的链表的地址

◆ insert()

People* insert ( List list,
People now,
int  id 
)

向now后插入一个人员号码为id的节点并返回新位置的函数

Parameters
list链表
now现在位置
id新节点的人员id
Returns
NULL插入失败,非NULL返回插入新位置
Here is the call graph for this function:

◆ malloc_l()

People* malloc_l ( List list)

类malloc(),为新节点用空节点分配位置的函数

Parameters
[in]list从list链表中分配位置
Returns
NULL执行失败,非NULL则执行成功为可放新节点的位置