#include <iostream>
using namespace std;
class Node {
public:
int d;
Node* nt;
};
void printList(Node* n)
{
while (n != NULL) {
cout << n->d << " ";
n = n->nt;
}
}
int main()
{
Node* h = NULL;
Node* s = NULL;
Node* t = NULL;
h = new Node();
s = new Node();
t = new Node();
h->d = 1;
h->nt = s;
s->d = 2;
s->nt = t;
t->d = 3;
t->nt = NULL;
printList(h);
return 0;
}
Comments
Leave a comment