feat: add contains functions

This commit is contained in:
tilo committed 2026-01-02 19:13:56 +01:00
1 parent f6cf78a10b
commit 4245d152fd
6 files changed
+69 -5

No files matched your search

+11 -1
View File
@@ -4,6 +4,7 @@
#include "tstd/list.h"
#include <stdint.h>
#include <string.h>
#include "helper.h"
@@ -64,4 +65,13 @@ void* list_delete_element(list* list, int index) {
list->data[i] = list->data[i + 1];
}
return element;
}
}
uint8_t list_contains(list* list, void* element) {
for (int i = 0; i < list->length; i++) {
if (list->data[i] == element) {
return 1;
}
}
return 0;
}