Shows "Error" in list building and printing code

This is the full code of this question

Compiles successfully but show “True” for non palindromes

I apologize for the delay.
Your code is correct.
But the logic you are using for reversing the list is wrong.

  1. There is no need to find the middle node.
  2. You should iterate the list till c!=NULL.
  3. There is no need to assign p to head just return p directly.
    (as you are passing a pointer as parameter i.e. head so it will get modified. Thus, both head and head1 will point the same node i.e. last node of the list)

Hope, this would help.
If you still have doubts, feel free to ask.