Problem with while loop

what was the problem that sir mentioned when he said that we shouldnt make condition for while loop to be tail!=NULL. Instead we should use tail->next=NULL.

hello @vector.9974 this is because you have to insert after tail so if you will not check if temp->next then you will rrach on null which is after tail and then you while loop will terminate thats why we have to terminate while loop one step before we have to do like this .
if yoou have any other doubt you can ask here .
Happy Learning !!

thank you sir…

if you feel that your doubt is cleared please mark this doubt as resolved .
Happy Learning !!