We need two data types to build a linked list:
template <typename Data> struct LListNode { Data data; LListNode<Data>* next; LListNode() {next = 0;} LListNode (const Data& d, LListNode<Data>* nxt = 0) : data(d), next(nxt) {} };
The linked list node
I'm doing this as a template so it can be easily re-used
The actual kind of data stored is not particularly important
template <typename Data> struct LListHeader { LListNode<Data>* first; LListHeader(); ⋮ };
The header for the entire linked list