#if 1 #include #include using namespace std; struct Node { string data; Node *next; }; Node* createSillyList(); int main() { Node* list = 0; list = createSillyList(); cout << "node 0 is: " << list << endl; cout << "word 0: " << list->data << endl; cout << list->data << endl; //data in first node //cout << list->next << endl; //this prints the address of the second node (stored in the first's node "next" element) cout << list->next->data << endl; //data in second node cout << list->next->next->data << endl; //data in third node // return 0; } // Make a new node to hold given string and add to front of list void my_addToFront(Node *&list, string data) { Node *temp = new Node; temp->data = data; temp->next = list; list = temp; } // Returns a simple list of nodes Node *createSillyList() { Node *list; my_addToFront(list, "hat"); my_addToFront(list, "the"); my_addToFront(list, "in"); my_addToFront(list, "cat"); return list; } #endif