void insertathead(nodehead,int d){
if (head==nullptr){
head=new node(d);
return;
}
noden=new node(d);
node* temp=head;
while(temp->next!=head){
temp=temp->next;
}
n->next=head;
temp->next=n;
head=n;
}
i have written this code for insertion what is the problem in this and
also why you make a self loop in the list to the new node