reversing linked list

后端 未结 9 1204
星月不相逢
星月不相逢 2020-12-10 16:52

I am trying to reverse a linked list using recursion and wrote the following code for it. The list is start of the list at the beginning.

 node *reverse_lis         


        
9条回答
  •  鱼传尺愫
    2020-12-10 17:07

    You forgot to update the next member of the first item on the linked list. Add parent->next = NULL; before the recursion call.

提交回复
热议问题