Skip to content

Commit

Permalink
Merge pull request wangzheng0822#414 from WhistlingArrow/master
Browse files Browse the repository at this point in the history
避免elem的next不为空导致的插入一个链表而非结点
  • Loading branch information
wangzheng0822 authored Nov 17, 2019
2 parents 420e3f5 + 16ed6a7 commit 61fa732
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions c-cpp/06_linkedlist/single_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ void insert(struct single_list **prev, struct single_list *elem)
if (!prev)
return;

if (*prev)
elem->next = *prev;
elem->next = *prev;
*prev = elem;
}

Expand Down

0 comments on commit 61fa732

Please sign in to comment.