Https://ide.codingblocks.com/s/484322

hello @anmolaggarwal.432

u are only checking for the first node is equal to last or not.

u have to check for every node

I need to iterate on every element data to check it

…

yeah, also u r modifying the original list becuase of that u may get wrong results.
create a clone of given list.
reverse the cloned list
and then match each node data of original list with clone node list

I have not passed it by reference hence i guess i have not modified the list and i am saving it in temp node nd then returnning and i have done it by iterating it is still showing that error

u r not passing by reference that doesnt means that it will not impact on original list.
all these lines will be change the original list
node*temp=reverse(head->next);
head->next->next=head;
head->next=NULL;

Can you please corect my code

…

there is nothing to correct , u need to reframe ur logic and code…

check this