Skip to content

Commit

Permalink
update listdemo.c
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkinben committed Oct 22, 2021
1 parent 6358682 commit 205ba87
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions listdemo.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ int main()

// allocate a dummy head node
node_t *head = (node_t *)malloc(sizeof(node_t));
head->value = -1;
init_list_head(&head->entry);

// add nodes
Expand All @@ -33,6 +34,7 @@ int main()
list_node_t *next;
list_for_each_safe(pos, next, &head->entry)
{
list_del(pos);
free(list_entry(pos, node_t, entry));
}

Expand Down

0 comments on commit 205ba87

Please sign in to comment.