Next: Exercises Up: Dynamic Memory Allocation Previous: Malloc

Linked Lists

Let us now return to out linked list example:

We can now try to grow the list dynamically:

~link = (ELEMENT *) malloc(sizeof(ELEMENT));

This will allocate memory for a new link.

If we want to deassign memory from a pointer use the free() function:


See Example programs (queue.c) in Appendix and try exercises for further practice.
Wed Sep 14 10:06:31 BST 1994