This is an to practice traversing a linked list. Given a pointer to the head node of a linked list, print each node's element, one per line. If the head pointer is null (indicating the list is empty), there is nothing to print.
Complete the printLinkedList function in the editor below.
printLinkedList has the following parameter(s):
SinglyLinkedListNode head: a reference to the head of the list
The first line of input contains , the number of elements in the linked list.
The next lines contain one element each, the values for each node.
Note: Do not read any input from stdin/console. Complete the printLinkedList function in the editor below.
, where is the element of the linked list.
There are two elements in the linked list. They are represented as 16 -> 13 -> NULL. So, the printLinkedList function should print 16 and 13 each on a new line.