Find The Middle Item

int find_middle(node *head)
{
    node *p1, *p2;
    p1 = p2 = head;
 
    while (p1 != NULL && p1->next != NULL) {
        p1 = p1->next->next;
        p2 = p2->next;
    }
 
    return p2;
}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License