0

Is there a way to get rid of first reverse function?

I have created code to reverse a linked list by recursion (second reverse function). But I am not able to assign NULL to the first element of original list to make it the last without creating another function (first reverse function) that creates a pointer to first element, calls the reversing function and then assigns that pointer to NULL. How can I get rid of the first function? https://code.sololearn.com/cfks42CDdFSi/?ref=app

30th Jan 2020, 5:22 AM
Aditya Rana
1 Resposta
0
Thank you Coder Kitten I found another solution. I could set the node to null in every iteration without causing any harm in functionality. I have another question...is there a way to set head as the default argument?
30th Jan 2020, 12:27 PM
Aditya Rana