翻转单链表,头结点没有初始化

翻转单链表,头结点没有初始化,会导致后面无法遍历
This commit is contained in:
Taoyu Su 2019-01-08 11:12:56 +08:00 committed by GitHub
parent 43af376694
commit adcbdda989
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,7 +74,7 @@ struct single_list** search(struct single_list_head* head, int target)
void reverse(struct single_list_head* head)
{
struct single_list_head tmp;
struct single_list_head tmp = {NULL};
struct single_list *elem;
while (!is_empty(head)) {