Not understanding piece of code

what is difference between

while(temp!=NULL)

and

while(temp->next!=NULL)

while(temp!=NULL)
will go till the node which is null i.e next to head
while(temp->next!=NULL)
will go till the last node only coz its next is null