Skip to content

Instantly share code, notes, and snippets.

@rpappalax
Created July 20, 2016 04:44
Show Gist options
  • Save rpappalax/f0346213a1340b949b65673626ddc740 to your computer and use it in GitHub Desktop.
Save rpappalax/f0346213a1340b949b65673626ddc740 to your computer and use it in GitHub Desktop.
typedef struct _node{
struct _node* next;
int data;
} NODE;
NODE *list_reverse_LONG_VERSION(NODE *head) {
// create local (temp) nodes to cache node pointers
NODE *prev = NULL;
NODE *current = head;
NODE *next;
while (current != NULL)
{
next = current->next;
current->next = prev;
prev = current;
current = next;
}
head = prev;
return head;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment