All languages

C

You're viewing a free preview. Sign in free to read every script.

Why this exists An array needs to know its size up front and moving things around means copying. A linked list stores each item in its own small block with a pointer to the next one, so adding and removing at known…

A Linked List in C: Nodes, a Job Queue, Safe Removal and Reversal

Build a singly linked list from scratch, with a tail pointer, removal of the head, middle and tail, in-place reversal and a leak-free free, then see the pointer-to-pointer trick that removes the special cases.

Sign in free to read this script, along with the rest of the library.

Sign in free