Hi. I was wondering if someone could explain to me how to make some new node point to the first element in a list.

Recommended Answers

All 2 Replies

The question seems a little vague out of context and you may need to provide more information.

To add a node to a list, you have to make some other pointer point to the new node then add a ponter to the current node to the next element of the list.

To insert the node at the start, the new node pointer points to the current first node and the initial pointer which indicated the start of the list is set to the new node.

create an inner list Node , which will have 3 feilds : prev ,next and data . If your creating a singly linked list , you can do with only data and next. next and/or previous will refer/point to the next/prev node in the list.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.