We start with a call to the destructor for the previous pointer. Note that we are using a static counter, count, to implement a nested indentation strategy for our diagnostic messages from the destructor calls.
// *************************************** //
// destructor for CHAR_SLLIST class //
// *************************************** //
CHAR_SLLIST::~CHAR_SLLIST()
{
if(head!=NULL){
delete head;
}
}