Element *reverse(Element *head)
{
Element *previous = NULL;
while (head != NULL) {

Element *next = head->next;
head->next = previous;
previous = head;
head = next;
}
return previous;
}

Advertisements