Reverse a linked list


The code is not working fine
Please tell the error in my code.


I have corrected your code. I declared the linked list as a global variable as the head has to be updated in the reversed function. I also made some changes to the function. Please check it.