Linked-List Basics

class myNode {

      int            i;

      myNode *next;

};

 

 

 

 

 

 

 

myNodePtr p;

p = head;

 

// walk the list until we get to the end

while (p != NULL) {

      cout << p->i << " ";

      p = p->next;

}