NodePtr revList = NULL

NodePtr currNode = currHead;

while(currNode != NULL)
{
        // Set the head to the next node
        currHead=currHead->next;
   
        // Link currNode to the reversed list
        currNode->next=revList;
        revList=currNode;
   
        // Move currNode to next node
        currNode=currHead;
        currHead=revList;
}

Designed By Blogger Templates | Templatelib & Distributed By Blogspot Templates