#include <iostream.h>
#include <conio.h>

static int bytes = 0;

struct Node {
Node() { bytes += sizeof(char); }
~Node() { bytes -= sizeof(char); }
char item;
Node* next;
};

int main() {
clrscr();
Node* head = new Node;
Node* curr = new Node;
head = curr;                  // save position of first element, so we know where our list starts

const int total = 5;
char c = ‘A’;
int i;
for (i = 0; i < total; ++i, ++c) {
curr->item = c;             // assign value
curr->next = new Node;      // create new element
curr = curr->next;          // move to that new element
}
curr->next = NULL;            // place a ‘stop’ sign

curr = head;                  // move to first element
for (i = 0; i < total; ++i) {
cout << curr->item << ” “;  // display element
curr = curr->next;          // move to next one
}
/*
for (i = total; i > 0; i–) {
curr = head;                // get position of first element
for (int j = 0; j < i; j++) {
curr = curr->next;        // move to the last element
}
delete curr;                // delete last element
}
*/
delete head;
delete curr;

cout << endl << “Bytes: ” << bytes;
return 0;
}