I found segmentation error ,plz solve this

#include
using namespace std;

class node{
public:
int data;
nodeleft;
node
right;

  node(int d){
      int data=d;
      node*left=NULL;
      node*right=NULL;
  }

};

node* insertinBST(node*root,int data){
//base case
if(root==NULL){
return new node(data);
}

//rec case 
if(data<=root->data){
    root->left=insertinBST(root->left,data);
}
else{
    root->right=insertinBST(root->right,data);
}
return root;

}

node* buildBST(){
int data;
cin>>data;

node*root=NULL;

while(data!=-1){
    root=insertinBST(root,data);
    cin>>data;
}
return root;

}

void printpreorder(node*root){
if(root==NULL){
return;
}

cout<<root->data<<" ";
printpreorder(root->left);
printpreorder(root->right);

}

int main() {
node*root=buildBST();
printpreorder(root);
cout<<endl;
// printlevelorder(root);

}

@Mohit
hello Mohit,
pls save ur code on -> https://ide.codingblocks.com/
and share the link

@Mohit
remove these datatypes
image

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.