-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.h
More file actions
31 lines (27 loc) · 717 Bytes
/
Copy pathnode.h
File metadata and controls
31 lines (27 loc) · 717 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
#ifndef LIST_H
#define LIST_H
/*
node of a linked_list, contains a reference to the previous and next nodes
and also a generic pointer to a value
*/
typedef struct node
{
void *value;
struct node *previous;
struct node *next;
}
node_t;
/*
*constructor of a node, memory is allocated in the heap so it needs to be freed
* value = pointer to the value to be incapsulated in the node
* returns a pointer to the newly created node
*/
node_t *create_node(void *value);
/*
*Function used to free a node and it's value
* node = node to be freed
* free_value = function that frees the memory of the value contained in the node
* returns NULL
*/
node_t *free_node(node_t *node, void free_value(void*));
#endif