libcproject
C static library easier to use than libc (C standard library).
array_list.h
Go to the documentation of this file.
1 #ifndef __LIBCPROJECT_ARRAY_LIST__
2 #define __LIBCPROJECT_ARRAY_LIST__
3 
4 #include <errno.h>
5 #include <stdbool.h>
6 #include <stdlib.h>
7 
8 #include "types.h"
9 
10 #define ARRAY_LIST_INITIAL_CAPACITY 10
11 
16 struct array_list {
17  void** data;
18  size_t size;
19  size_t capacity;
20 };
21 
27 
35 void array_list_add(struct array_list* list, void* element);
36 
44 void array_list_remove(struct array_list* list, size_t index);
45 
54 void* array_list_get(struct array_list* list, size_t index);
55 
62 void array_list_free(struct array_list* list);
63 
64 #endif
size_t size
Definition: array_list.h:18
void array_list_add(struct array_list *list, void *element)
Adds an element to the end of the array list.
struct array_list * array_list_initialization()
Initializes a new array list.
void * array_list_get(struct array_list *list, size_t index)
Gets an element from the array list.
void array_list_free(struct array_list *list)
Frees the array list.
void ** data
Definition: array_list.h:17
void array_list_remove(struct array_list *list, size_t index)
Removes an element from the array list.
size_t capacity
Definition: array_list.h:19
A dynamic array implementation.
Definition: array_list.h:16