Built the basement of the list.

This commit is contained in:
Saturneric 2018-02-07 20:09:44 +08:00
parent c64f6ad4bf
commit 8f6da2622f
2 changed files with 38 additions and 0 deletions

View File

@ -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;
}

View File

@ -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);