Palindrome-Linked lists

Please find error in my code on linked list and help me rectify it…
code:


added the comments for mistakes
advice: make a separate function for reversing the list ahead of the middle node and then use it. Start temp 2 from slow->next for odd number of nodes and at slow for even number of nodes, you are close to the correct solution just think carefully for the cases of odd and even number of lists and dry run your code once and then implement the advice, u will be at the right solution soon enough

I am not able to rectify it to succeed.Pls rectify my code…and help me

Node *reverse(Node *root)
{
if(root == NULL || root->next ==NULL)
{
return root;
}
Node *current = root;
Node *prev = NULL;
Node *ahead = NULL;
while(current !=NULL)
{
ahead = current->next;
current->next = prev;
prev = current;
current = ahead;
}
return prev;
}
bool isPalindrome(Node *head)
{
//Your code here
Node *fast = head;
Node *slow = head;
if(head == NULL || head->next==NULL)
{
return true;
}
while(fast->next!=NULL && fast!=NULL)
{
if(fast->next->next == NULL)
{
slow = slow->next;
fast = NULL;
break;
}
fast = fast->next->next;
slow = slow->next;
}
if(fast == NULL)
{

    slow = reverse(slow);
}
else
{
    slow = slow->next;
    slow = reverse(slow);
}
fast = head;
while(slow!=NULL)
{
    if(fast->data != slow->data)
    {
        return false;
    }
    fast = fast->next;
    slow = slow->next;
}
return true;

}

Use this function it will help you

Thank you.Now I understand the code.My doubt has been cleared

Hi,can you tell me why my code is not passing any of the test cases/
Link:https://ide.codingblocks.com/s/571077
I want to know what wrong am i doing in my code