aboutsummaryrefslogtreecommitdiff
path: root/include/array.h
diff options
context:
space:
mode:
authorPreston Pan <ret2pop@gmail.com>2024-12-24 21:11:06 -0800
committerPreston Pan <ret2pop@gmail.com>2024-12-24 21:11:06 -0800
commite75d6f6b8f4512a5bbfecbfa8c17f0bb687e3d55 (patch)
tree7a96002751a1ca3b173762a13b181ebea4123817 /include/array.h
first commit
Diffstat (limited to 'include/array.h')
-rw-r--r--include/array.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/array.h b/include/array.h
new file mode 100644
index 0000000..48d82db
--- /dev/null
+++ b/include/array.h
@@ -0,0 +1,18 @@
+#ifndef ARRAY_H
+#define ARRAY_H
+#include <stdlib.h>
+#define DEFAULT_ARR_LEN 10
+typedef struct {
+ void **items;
+ size_t size;
+ size_t capacity;
+} array_t;
+
+array_t *init_array();
+
+void array_push(array_t *a, void *item);
+
+void *array_pop(array_t *a);
+
+void array_free(void *a, void (*freefunc)(void *));
+#endif