i aint able to get the difference between temp->next!=NULL and temp!=NULL and how do we use them ??
GENERAL DOUBT about linked list
@gabbar_2229 Here temp pointer is commonly used to iterate through the linked list.
temp->next!= NULL is different from temp!=NULL.
temp->next!=NULL means that the the next pointer of the current node is pointing to a node which is not NULL.
temp!=NULL means that the current node(the node at which temp pointer is pointing) is not NULL
We generally use this in termination condition while traversing the linked list as we know that is linked list is always terminated by a NULL(or the next pointer of the last node is always pointing to null).
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.