Imprimir elementos da lista vinculada

void printLinkedList(SinglyLinkedListNode* head) {
while(head!=NULL)
{
cout<<head->data<<endl;
head=head->next;
}
​
}
Determined Dormouse