diff --git a/list/list.c b/list/list.c index e69de29..f964bb4 100644 --- a/list/list.c +++ b/list/list.c @@ -0,0 +1,14 @@ +/* ******************************************************** + * This file is used to test the header file(list.h). + * When the project is finished, this file will be deleted. + * This file create by saturneric at 20:04 on Feb 7th. + * *******************************************************/ + +#include +#include +#include "list.h" + +int main(int argc, char **argv){ + + return 0; +} diff --git a/list/list.h b/list/list.h index e69de29..ae912f5 100644 --- a/list/list.h +++ b/list/list.h @@ -0,0 +1,24 @@ +typedef struct Node{ + unsigned long int id; + void *value; + struct Node *next; + struct Node *front; +} Node; + +typedef struct List{ + Node *head; + Node *tail; + unsigned long int length; +} List; + +List *init_list(); +Node *init_node(); +int insertInHead(List *p_list, Node *p_node); +int insertInTail(List*p_list, Node *p_node); +int removeById(List *p_list, unsigned long id); +int removeByNode(List *p_list, Node *p_node); +int popFromHead(List *p_list); +int popFromTail(List *p_list); +unsigned long int len(List *p_list); +Node *findById(List *p_list, unsigned long int id); +Node *findByValue(List *p_list, char type[], void *value);