fix(linked list): fixed size not updating on append
This commit is contained in:
parent
9d571c694e
commit
d89747a2ed
2 changed files with 7 additions and 0 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue