From e72088d79804e4f689196f4bc700fb9348c77209 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Sat, 24 Jan 2026 22:28:22 -0500 Subject: initial commit --- array.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 array.h (limited to 'array.h') diff --git a/array.h b/array.h new file mode 100644 index 0000000..848e1a7 --- /dev/null +++ b/array.h @@ -0,0 +1,23 @@ +#ifndef __SAFEC_ARRAY_H +#define __SAFEC_ARRAY_H +#include + +/* TODO: it might be good to just have itemsz and char* data */ +typedef struct { + size_t length; + void** data; +} array_t; + +void array_set(array_t* array, size_t idx, void* val); +void* array_get(const array_t* array, size_t idx); + +typedef struct { + size_t length; + char* data; +} str_t; + +void str_set(str_t* str, size_t idx, char val); +char str_get(const str_t* str, size_t idx); +/* TODO: I would like to implement string slicing as part of this */ +/* TODO: reimplement string.h functions for this new string construct */ +#endif -- cgit v1.2.3