#Linked list practice problem help
5 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
presumably you would pass in the head node and the number of elements in the linked list. So, once the function is called, you could exam the linked list from the head node after calling the function to know the remaining content.
An iteration through the loop:
current = head
other = head->next
3 → 8 → 12 → 5 → 1 → ...
↑ ↑
c o
current->next = other->next
3 → 8 → 12 → 5 → 1 → ...
↑ ↑ ↑
c o c.n
free(other)
3 → 12 → 5 → 1 → ...
↑ ↑
c c.n
current = current->next
3 → 12 → 5 → 1 → ...
↑
c
if (check)
current = current->next
other = current->next
3 → 12 → 5 → 1 → ...
↑ ↑
c o
```The head of the list (in the example `3` rather than `head`) isn't modified, so it remains at the same address before and after the function call
This question is being automatically marked as stale.
If your question has been answered, type !solved.
If your question is not answered feel free to bump the post or re-ask.
Take a look at !howto ask for tips on improving your question.