Clarification on linked-list node
I am trying to understand what a linked-list node is. What is passed to
the constructors? In particular, what is node* head? It is a pointer to
the structure itself. How does a linked-list fit in with this structure?
struct node {
node* next;
int data;
explicit node(int data) : node(nullptr, data) {}
node(node* head, int data) : next(head), data(data) {}
}
No comments:
Post a Comment