Linked list insertion at head

class node{

public :
int data ;
node *next;

node(int d){
	data = d;
	next = NULL;	
}

};

void insertathead(node*&head ,int d){

if(head == NULL){
	head = new node(d);      //****
	return;
}

node*n = new node(d);
n->next = head ;
head = n ;

}

how the value is assigned in the star marked code? is constructor being called?

node(int d){
	data = d;
	next = NULL;	
}

through this value is assigned to node…

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.