Finding an element in a linked list and printing it out →
Now, that we are slowly becoming experts in navigating through the nodes in the linked list, let us see how we can print the nodes of our linked list. Again, the idea is very simple:
- Start from the head node
- Traverse the linked list until the list ends (node pointing to NULL)
- On the way, print the data part (interesting part) of our list
This is an iterative solution. We will soon look at a recursive solution to this. Stay tuned.