Algorithms_in_C 1.0.0
Set of algorithms implemented in C.
Loading...
Searching...
No Matches
dynamic_array.h
1#ifndef __DYNAMIC_ARRAY__
2#define __DYNAMIC_ARRAY__
3#define DEFAULT_CAPACITY 1 << 4
4#define INDEX_OUT_OF_BOUNDS NULL
5
6typedef struct dynamic_array
7{
8 void **items;
9 unsigned size;
10 unsigned capacity;
12
13extern dynamic_array_t *init_dynamic_array();
14
15extern void *add(dynamic_array_t *da, const void *value);
16
17extern void *put(dynamic_array_t *da, const void *value, unsigned index);
18
19extern void *get(dynamic_array_t *da, const unsigned index);
20
21extern void delete (dynamic_array_t *da, const unsigned index);
22
23unsigned contains(const unsigned size, const unsigned index);
24
25extern void *retrive_copy_of_value(const void *value);
26
27#endif
Definition dynamic_array.h:7