-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist.h
More file actions
65 lines (55 loc) · 1.26 KB
/
list.h
File metadata and controls
65 lines (55 loc) · 1.26 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#ifndef list_h
#define list_h
#include <stdlib.h>
typedef struct node_t {
void *info;
struct node_t *previous;
struct node_t *next;
} node_t;
typedef struct list_t {
node_t *first;
node_t *last;
int count;
} list_t;
/**
* Creates and reserves memory for an empty list_t.
*
* @return a pointer to the newly created list_t.
*/
list_t *createEmptyList();
/**
* Returns the void* stored in the first node_t of the list_t.
*
* @param list the specific list_t.
* @return the specific void*.
*/
void *getFirstInfo(list_t const *list);
/**
* Returns the void* stored in the last node_t of the list_t.
*
* @param list the specific list_t.
* @return the specific void*.
*/
void *getLastInfo(list_t const *list);
/**
* Checks whether a list_t is empty.
*
* @param list the specific list_t.
* @return true if the list is empty, in any other case returns false.
*/
int isEmpty(list_t const *list);
/**
* Adds a void* to the list_t.
*
* @param list the specific list.
* @param info the specific void*.
*/
void addInfo(list_t *list, void *info);
/**
* Returns how many void* are stored in the list.
*
* @param list the specific list_t.
* @return the amount of void* stored in this list_t.
*/
int getCount(list_t const *list);
#endif