feat: add contains functions

This commit is contained in:
2026-01-02 19:13:56 +01:00
parent f6cf78a10b
commit 4245d152fd
6 changed files with 69 additions and 5 deletions

12
list.c
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;
}