back to scratko.xyz
summaryrefslogtreecommitdiff
path: root/dynamic_array.h
diff options
context:
space:
mode:
authorscratko <m@scratko.xyz>2024-04-23 19:03:35 +0300
committerscratko <m@scratko.xyz>2024-05-25 21:12:30 +0300
commitc1e5cffb43977f5a2f8d9623e40c01dab6d80c46 (patch)
tree31c9c9b6847c292b13a354d962b86b6f5e15bb26 /dynamic_array.h
downloadshell-c1e5cffb43977f5a2f8d9623e40c01dab6d80c46.tar.gz
shell-c1e5cffb43977f5a2f8d9623e40c01dab6d80c46.tar.bz2
shell-c1e5cffb43977f5a2f8d9623e40c01dab6d80c46.zip
Shell-I releaseshell-I
Diffstat (limited to 'dynamic_array.h')
-rw-r--r--dynamic_array.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/dynamic_array.h b/dynamic_array.h
new file mode 100644
index 0000000..98491ea
--- /dev/null
+++ b/dynamic_array.h
@@ -0,0 +1,20 @@
+#ifndef DYNAMIC_ARRAY_H_SENTRY
+#define DYNAMIC_ARRAY_H_SENTRY
+
+enum {
+ initial_size = 10
+};
+
+struct dynamic_array {
+ char *arr;
+ int last_element_index;
+ int allocation_size;
+};
+
+void dynarr_create_array(struct dynamic_array *array);
+void dynarr_push_back(struct dynamic_array *array, int letter);
+void dynarr_copy_array(struct dynamic_array *array, char *new_arr);
+void dynarr_drop_word(struct dynamic_array *array);
+void dynarr_clear(struct dynamic_array *array);
+
+#endif