Linked List Insetion at Tail

In insertion at Tail we have used while(temp->next!=NULL) and during print we have used while(temp!=NULL). I want to ask that in tail we are pointing to temp->next and during print we are pointing towards data. Am I right???

hello @ashwani225
In insertion at tail , we are using condition temp->next!=NULL because we want to stop at tail so that we can insert our new element to next of it.

while in print , we are using condition temp!=NULL this will stop when ur temp will become NULL .

In both of them temp is pointing to current data only.

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.