--- a/docs/Writerside/topics/list.h.md Sat Apr 12 21:32:31 2025 +0200 +++ b/docs/Writerside/topics/list.h.md Sun Apr 13 11:09:05 2025 +0200 @@ -162,6 +162,8 @@ void *cxListAt(const CxList *list, size_t index); +int cxListSet(CxList *list, size_t index, const void *elem); + size_t cxListFind(const CxList *list, const void *elem); size_t cxListFindRemove(CxList *list, const void *elem); @@ -176,6 +178,12 @@ Otherwise, a pointer to element at the specified index is returned. If the index is out-of-bounds, the function returns `NULL`. +The function `cxListSet()` allows you to modify elements at a specific index in the list. +This function replaces the element at the specified `index` with the value pointed to by `elem`. +If the list is storing values directly (not pointers), the contents at the memory location `elem` will be copied into the list. +If the list is storing pointers, the pointer value itself will be stored. +The function returns `0` on success and `1` if the index is out of bounds. + On the other hand, `cxListFind()` searches for the element pointed to by `elem` by comparing each element in the list with the list`s compare function, and returns the first index when the element was found. Otherwise, the function returns the list size.