Created
March 4, 2019 06:06
-
-
Save ben-ng/33a6de83c71046fca6a03fcc749a471b to your computer and use it in GitHub Desktop.
Reverse a linked list in C
This file contains 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
while (current != null) { | |
next = current->next; | |
current->next = prev; | |
prev = current; | |
current = next; | |
} | |
head = prev; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment