Self-referential Structures
To realise a "chain of elements", need a node containing
- a value
- a link to the next node
To represent a chained (linked) list of nodes:
- we need a pointer to the first node
- each node contains a pointer to the next node
- the
next pointer in the last node is NULL
|