Print the Elements of a Linked List

  • + 0 comments

    C++ Solution

    void printLinkedList(SinglyLinkedListNode* head) {
        SinglyLinkedListNode* p=head;
        while(p!=0){
            cout<<p->data<<endl;
            p=p->next;
        }
    }