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.
Fri May 20 13:40:49 BST 1994