Traversing a single linked list in order
问题 I have been trying to think a way to traverse a single linked list. This is so far what I have done: #include <iostream> typedef struct node { int data; // will store information node *next; // the reference to the next node }; int printList(node *traverse) { if (traverse->next == NULL) { return -1; } traverse=traverse->next; printList(traverse); cout << traverse->data << endl; return 0; } int main() { node *head = NULL; for (int i = 0; i < 10; i++) { node *newEntry = new node; newEntry->data