void reverse(node **head) {
node *current = *head;
node *result = 0;
node *next;
while (current != 0) {
next = current->next;
current->next = result;
result = current;
current = next;
}
*head = result;
}
No comments:
Post a Comment