Doubt in the video of Circular linked list

Sir, in the insert function explained in the video, why the condition if(temp!=NULL)has been used?(3.48 sec)
It is a circular llist so temp will never be null, then what is the need to use this extra condition.

Also, I am not clear about using of self loop.
Can you please explain.

hello @vageesha

if cirular list is empty i,e 0 nodes.
then in that case head will be NULL, and becuase we are assigning head to temp .temp will also be null, so that is why before iterating we are ensuring that the list is not empty.

i didnt get this part. what u want to ask ?

in the video, it is shown that if temp is not equal to null in that case n->next=n, I am not clear how this will affect the other nodes?

sorry, I mean if temp is equal to null**

dryrun the insertion code for first insertion (i.e when list is empty and u are going to insert the very first node)