Segmentation fault

#include<bits/stdc++.h>
using namespace std;
class node{
public:
int data;
nodenext;
node(int d){
data = d;
next = NULL;
}
};
void insertAttail(node
&head ,int data){
if(head==NULL){
head = new node(data);
return;
}
node*tail = head;
while(tail->next!=NULL){
tail = tail->next;
}
tail->next = new node(data);
return;

}
node *take_input(node head ,int size){
while(size–){
int d;
cin>>d;
insertAttail(head ,d);
}
return head;
}
void print(node
head){
while(head!=NULL){
cout<<head;
head = head->next;
}
}
int main() {
node *l1 = NULL;
node *l2 = NULL;
int t;
cout<<“Enter the no of testcases”<<endl;
cin>>t;
while(t–){
int n1;
cout<<“Enter the size of list 1----”;
cin>>n1;
cout<<“Enter the elements of list 1----”;

take_input(l1,n1);

print(l1);
cout<<"Enter the size of list 1----";
int n2;cin>>n2;
cout<<"Enter the elements of list 2----";
take_input(l2,n2);
print(l2);
while(l1->next!=NULL){
	l1 = l1->next;
}
l1 = l2;
print(l1);
}
return 0;

}

hi @anjalipal2102003_eabe4f91da0a918f save the code on ide.codingblocks.com
its not readable here

  1. login
  2. write
  3. save (ctrl + s)
  4. send the url of the page

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.