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
1 Antwort
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?