#include "Node.h"

int main( )
{
    Node head;

    // Insert nodes into the list:
    head.insert( new Node( 123 ) );
    head.insert( new Node( 456 ) );

    print_list( head ); // display nodes

    // Remove all dynamic nodes from the list:
    Node* iter = head.pnext;
    while ( iter != NULL ) {
        Node* obsolete = iter;
        iter = iter->pnext;
        delete obsolete; // remove node from memory
    }

    // Safe programming practice:
    // indicates that no dynamic nodes are present
    head.pnext = NULL;

    return 0;
}

