Timeline for Reversing a linked list
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 21, 2012 at 21:13 | history | edited | dmastylo | CC BY-SA 3.0 |
added 2 characters in body
|
Oct 21, 2012 at 18:02 | review | First posts | |||
Oct 21, 2012 at 18:18 | |||||
Oct 20, 2012 at 19:31 | comment | added | dmastylo | Yeah that was my bad, forgot to add the by ref. | |
Oct 20, 2012 at 16:03 | comment | added | Blastfurnace |
This code doesn't work. The node pointer is passed by value so the caller's copy of the pointer is unchanged. The typical solution is to return the new head value (see zdd's answer).
|
|
Oct 20, 2012 at 8:43 | comment | added | dmastylo | Good call. The error message is unnecessary I'd say. | |
Oct 20, 2012 at 7:19 | comment | added | zdd | You needn't to check node in the if block, since you did it in the while loop. | |
Oct 20, 2012 at 6:26 | history | answered | dmastylo | CC BY-SA 3.0 |