S
sharat
hi..
In the following c++ program for tree(binary search .)
while compiling i m getting the following error .
program is :
btree.cpp
class btree
{
public:
struct node
{
node *left;
char data;
node *right;
} *root;
char *arr;
int *lc;
int *rc;
public:
btree(char *a, int *l, int *r, int size);
void insert(int index);
static node* buildtree(char *a, int *l, int *r, int index);
void display();
static void inorder(node *sr);
~btree();
static void del(node *sr);
};
node* btree :: buildtree(char *a, int *l, int *r, int index)
{
node *temp = NULL;
if(index != -1)
{
temp = new node;
temp->left = buildtree(a, l, r, *(l + index));
temp->data = *(a + index);
temp->right = buildtree(a, l, r, *(r + index));
}
return temp;
}
# g++ btree.cpp
btree.cpp:54: error: expected constructor, destructor, or type
conversion before '*' token.
can any one plz help to sort it out.
In the following c++ program for tree(binary search .)
while compiling i m getting the following error .
program is :
btree.cpp
class btree
{
public:
struct node
{
node *left;
char data;
node *right;
} *root;
char *arr;
int *lc;
int *rc;
public:
btree(char *a, int *l, int *r, int size);
void insert(int index);
static node* buildtree(char *a, int *l, int *r, int index);
void display();
static void inorder(node *sr);
~btree();
static void del(node *sr);
};
node* btree :: buildtree(char *a, int *l, int *r, int index)
{
node *temp = NULL;
if(index != -1)
{
temp = new node;
temp->left = buildtree(a, l, r, *(l + index));
temp->data = *(a + index);
temp->right = buildtree(a, l, r, *(r + index));
}
return temp;
}
# g++ btree.cpp
btree.cpp:54: error: expected constructor, destructor, or type
conversion before '*' token.
can any one plz help to sort it out.