fix(linked list): fixed size not updating on append

This commit is contained in:
Mineplay 2025-04-25 15:48:09 -05:00
parent 9d571c694e
commit d89747a2ed
2 changed files with 7 additions and 0 deletions

View file

@ -99,6 +99,7 @@ FledastyError fledasty_linked_list_append(FledastyLinkedList *current_linked_lis
new_node->next = NULL;
current_linked_list->end->next = new_node;
current_linked_list->size += 1;
return FLEDASTY_ERROR_NONE;
}

View file

@ -110,6 +110,12 @@ int main() {
fledasty_linked_list_append(&test_linked_list, &i);
}
FledastyLinkedListNode *test_linked_list_node = test_linked_list.start;
for (int i = 0; i < test_linked_list.size; i++) {
printf("Linked list get: %d\n", *(int*)test_linked_list_node->value);
test_linked_list_node = test_linked_list_node->next;
}
fledasty_linked_list_destroy(&test_linked_list);
printf("Done\n");
return 0;