#include #include using namespace std; struct node { int val; node* next; }; void DelNode(node*& H) { node* p = H; H = H->next; delete p; } void showList(node* H) { node* p = H; while (p != NULL) { cout << p->val << "->"; p = p->next; } cout << "NULL" << endl << endl; } void add(node*& H, int x) { node* p = new node; p->val = x; p->next = H; H = p; } int main() { node* H = NULL; add(H,8); add(H,3); add(H,10); add(H,5); add(H,1); showList(H); system("pause"); return 0; }