Singly-linked list/Reversal: Difference between revisions

Content added Content deleted
imported>StraightDoubt
(Added a routine for the language C.)
imported>StraightDoubt
Line 49: Line 49:
== C ==
== C ==
This code works by reversing the pointers in the list. The function returns the new beginning of the list, or NULL if passed a null pointer.
This code works by reversing the pointers in the list. The function returns the new beginning of the list, or NULL if passed a null pointer.

<syntaxhighlight lang="C">

#include <stdlib.h>
#include <stdlib.h>
Line 67: Line 70:
return prev;
return prev;
}
}

</syntaxhighlight>


=={{header|Delphi}}==
=={{header|Delphi}}==