Circular Singly Linked list


what is the error in the code,not printing anything?

Hey @Vibhuti0206
The issue was with your print function.

p = last->next;
while(p != last->next)
{
cout<data<<" ";
p = p->next;
}

You initialise p as last->next, then in the loop you want to print till p != last->next. Since you initialised it as last->next itself, the loop is never entered. Hence, nothing is printed.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.