forked from doctor-phil/network
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinked_list.h
More file actions
42 lines (34 loc) · 941 Bytes
/
Copy pathlinked_list.h
File metadata and controls
42 lines (34 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* This is a linked list data structure implementation.
*/
#ifndef __LINKEDLIST_HEADER
#define __LINKEDLIST_HEADER
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
typedef struct _Node
{
void* data;
struct _Node* next;
struct _Node* prev;
} Node;
typedef struct _LinkedList
{
Node* first;
Node* last;
int size;
int itemSize;
char* typeName;
} LinkedList;
LinkedList* linked_list_initialize(int, char*);
bool linked_list_add_at(LinkedList*, int, void*);
bool linked_list_add_first(LinkedList*, void*);
bool linked_list_add_last(LinkedList*, void*);
void* linked_list_get(LinkedList*, int);
int linked_list_index_of(LinkedList*, void*);
void* linked_list_remove(LinkedList*, int);
void* linked_list_remove_first(LinkedList*);
void* linked_list_remove_last(LinkedList*);
int linked_list_size(LinkedList*);
void linked_list_swap(LinkedList*, int, int);
#endif