Regarding circular linked list

can u tell me wts wrong in my code and tell me wts the mistake.

Because of while loop condition it is not printing last one.

we should use do while loop
do{
logic
temp=temp->next;
} while(temp!=head);
If this resolves your query then please mark it as resolved :slight_smile:

but it is circular linked list how can we do temp!=head it will not print other elements you only check the code and in that corrections pls mention that mistakes

do{
        cout<<temp->data<<endl;
        temp=temp->next;
}while(temp->next!=head);

do this in display :slight_smile: