Let's put the learning to use. We already learnt how to traverse a Linked List using a while loop . We have to keep two things in mind:
Take head as the starting reference.
Loop till p is not NULL.
Sanad has a problem, he is a beginner to Linked Lists just like you and he needs your help.
Given a linked list fill the function printList() to print the elements of the list. You have to print each element of the list in a new line.