I get the error " no match for 'operator=' in '* n->node::child = root' in the "insert" method and I don't know how to fix it. I know it has something to do with pointers and the way I initialized the array. What I want to do is is put the 'root' in the parameter of the "insert" method in an array of type node. How can I do this? Could I get some pseudo-code please? I am at a loss. Don;t have much c++ experience.
struct node{
/*
struct node operator=(struct node root) {
if(this == &root){
return *this;
}
}
*/
int numOfKeys;
double* array;
double* value;
int count ;
struct node *child;
int i;
int j;
};
/*
* Node creator
*/
struct node* create (int keyNum){
int size=2*keyNum;
struct node* ptr;
ptr->value=new double[size];
ptr->child=new node [size];
ptr->numOfKeys=0;
ptr->i=0;
ptr->j=ptr->i+1;
return ptr;
};
FILE *txtFile;
node *root;
int numOfNodes=0;
struct node * insert ( int, struct node * ) ;
int setval ( int, struct node *, int *, struct node ** ) ;
struct node * search ( int, struct node *, int * ) ;
int searchnode ( int, struct node *, int * ) ;
void fillnode ( int, struct node *, struct node *, int ) ;
void split ( int, struct node *, struct node *, int, int *, struct node ** );
struct node * insert ( int val, struct node *root )
{
int i ;
struct node *c;
int flag ;
flag = setval ( val, root, &i, &c ) ;
if ( flag )
{
struct node *n =create(treeOrder);
n -> count = 1 ;
n -> value[1] = i ;
n -> child[0] =root ;
n->child[1]=c;
return n ;
}
return root ;
}