class btree{
public:
int non,vor;
string str;
struct tree{
int data;
struct tree *lnode;
struct tree *rnode;
};
};
int main(){
}
how to access structure type pointer lnode in main is it even possible help????
class btree{
public:
int non,vor;
string str;
struct tree{
int data;
struct tree *lnode;
struct tree *rnode;
};
};
int main(){
}
how to access structure type pointer lnode in main is it even possible help????
You defined the struct tree
, but didn't actually put any into your btree
. Do this instead:
class btree {
public:
int non, vor;
string str;
struct tree {
int data;
struct tree *lnode;
struct tree *rnode;
} node; // note the "node" that was added, now btree contains a struct tree named "node"
};
Access it like this:
int main() {
btree myTree;
myTree.node.data = 10;
}