mirror of
https://github.com/theoludwig/libcproject.git
synced 2025-05-21 23:21:15 +02:00
fix: error in array_list_remove (always removed the last index and not the index given) (#6)
Co-authored-by: Maxime Rumpler <mrumpler68@gmail.com>
This commit is contained in:
@ -25,8 +25,8 @@ void array_list_remove(struct array_list* list, size_t index) {
|
||||
if (index >= list->size) {
|
||||
return;
|
||||
}
|
||||
for (size_t i = index + 1; i < list->size - 1; i++) {
|
||||
list->data[i - 1] = list->data[i];
|
||||
for (size_t i = index; i < list->size - 1; i++) {
|
||||
list->data[i] = list->data[i + 1];
|
||||
}
|
||||
list->size--;
|
||||
}
|
||||
|
Reference in New Issue
Block a user