initial list.h commit

This commit is contained in:
Odweta
2023-12-22 00:39:17 +01:00
parent b8235f3fa9
commit ea527405e5
6 changed files with 166 additions and 16 deletions
+26
View File
@@ -0,0 +1,26 @@
/*
* What is this?
*
* A list (as I interpret it in this library)
* is a `vector_t` of other `vector_t`s, where
* every inner `vector_t` can be of any type ->
* this means a Python-like list
*/
#include <odweta/vector.h>
typedef long unsigned int size_t;
typedef struct {
size_t size; // number of elements that are inside the list
size_t capacity; // how many elements can be put inside
vector_t* data; // vector of vectors
} list_t;
list_t* listInit(); // returns a new list
void listPush(list_t* l, dataType_e type, void* element); // appends an element at the end of a list
void listPrint(list_t* l); // prints a list
void listCleanup(list_t* l); // freeing pointers
+7 -1
View File
@@ -51,4 +51,10 @@ vectorToString(vector_t* v); // convert the vector into a regular string
void*
vectorGetAt(vector_t* v, int index); // get an element at the given index
#endif
void _printVectorRecursive(vector_t* v, int depth);
#endif