In linked list does next pointer contain address of next node actually? Or it just points to the data variable of next node. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

In linked list does next pointer contain address of next node actually? Or it just points to the data variable of next node.

https://code.sololearn.com/c8vlCmSrjB1z/?ref=app

19th Sep 2018, 5:30 PM
Kishor Jena
Kishor Jena - avatar
2 Answers
0
In a linked list, the "next" pointer usually points to the next node, so you can traverse the list through the pointers.
19th Sep 2018, 7:57 PM
Shadow
Shadow - avatar
0
First node or head or root whatever it is, holds the address of data part of next node? And we call it next pointer is pointing 👉 to next node. When we allocate memory for one node malloc allocate size for those 2 part of node(data variables & next pointer) and return the address of data variable? 🤔 When i print &data and &head->data. Addresses are same
20th Sep 2018, 6:38 AM
Kishor Jena
Kishor Jena - avatar