Created
July 20, 2016 04:44
-
-
Save rpappalax/f0346213a1340b949b65673626ddc740 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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