Built the basement of the list.
This commit is contained in:
parent
c64f6ad4bf
commit
8f6da2622f
14
list/list.c
14
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 <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "list.h"
|
||||||
|
|
||||||
|
int main(int argc, char **argv){
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
24
list/list.h
24
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);
|
Loading…
Reference in New Issue
Block a user