Palinfrom linked list -Leet code

ques–>https://leetcode.com/problems/palindrome-linked-list/

ide->https://ide.codingblocks.com/s/206458

here i reversed the linked list and checking one by one each node. but what is wrong in the code?

Hi
the problem is that the original linked list gets updated on calling the reverse function
even thought the head pointer is passed as value and u do not expect it to be updateed in the int main () function
but this not so because in the reverse function u are updating the pointer of the linked list hence the linked list gets updated permanently

hence head has now been manipulated
if u try printing whats in the linked list with ‘head’ has its head
u`ll recieve the first element only

so
u need to use some other approach
in case u are not able to firgure out
ask in comments below