Intro

Reversing

Iterative

void List_reverse(List *list)
{
    List_node *curr = list->head;
    List_node *next = 0;
    List_node *prev = 0;

    while(curr)
    {
        next = curr->next;
        curr->next = prev;
        prev = curr;
        curr = next;
    }

    list->head = prev;
}

Recursive

List_node *List_do_reverse(List_node *head)
{
    if (head == NULL || head->next == NULL)
    {
        return head;
    }

    List_node *reversed_list_head = List_do_reverse(head->next);
    head->next->next = head;
    head->next = 0;
    return reversed_list_head;
}

void List_reverse_recursive(List *list)
{
    list->head = List_do_reverse(list->head);
}