current -> tail in zad2
This commit is contained in:
parent
f2f78e0cfa
commit
685d4db676
1 changed files with 5 additions and 5 deletions
|
@ -28,13 +28,13 @@ void linked_list_insert(LinkedList *l, void *value) {
|
|||
return;
|
||||
}
|
||||
|
||||
Node *current = l->head;
|
||||
while (current->next != l->head) {
|
||||
current = current->next;
|
||||
Node *tail = l->head;
|
||||
while (tail->next != l->head) {
|
||||
tail = tail->next;
|
||||
}
|
||||
|
||||
current->next = node_new(value, l->element_size);
|
||||
current->next->next = l->head;
|
||||
tail->next = node_new(value, l->element_size);
|
||||
tail->next->next = l->head;
|
||||
l->length += 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue