Saturday, 4 May 2013

void reverseList( struct node **headRef){
    struct node *current = *headRef;
    struct node *prev = NULL;
    struct node *next;
    while(current != NULL){
        next = current->next;
        current->next = prev;
        prev = current;
        current = next;
    }
    *headRef = prev;
}