When i was compiling the code it show error to define tail i didn't understand please help me out

#include
using namespace std;

class node{
public:
int data;
nodenext;
node(int d){
data=d;
next =NULL;
}
};
void insertAt_head(node
&head,int data){
noden = new node(data);
n->next = head;
head =n;
}
int length(node
head){
int len =0;
while(head != NULL){
head = head->next;
len +=1;
}
return len;
}

void insertAt_tail(node*&head, int data){
if(head==NULL){
head = new node(data);
return;
}

 head*tail = head ;
 while(tail->next!=NULL){
    tail = tail->next;

 }
 tail->next =new node(data);
 return;

}
void insertAt_middle(node*&head,int data,int p){

 if(head=NULL){
    insertAt_head(head,data);
 }else if(p>length(head)){
     insertAt_tail(head,data);
 }else{
     int jump =1;
     node*temp =head;
     while(jump<=p-1){
        temp = temp->next;
        jump += 1;
     }
     node*n = new node(data);
     n->next = temp->next;
     temp->next =n;
 }

}

void print(node*head){
while(head!=NULL){
cout<< head->data<<" -> ";
head= head->next;}
}

int main(){
node*head= NULL;
insertAt_head(head,3);
insertAt_head(head,4);
insertAt_head(head,2);
insertAt_tail(head,6);
insertAt_middle(head,5,3);
print(head);
return 0;
}

@rohit_sharma hey please apna code ide pr dal ke share kro ,I will help you bro.

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.