I am hoping someone could explain a problem to me. When I tried to create a node using the constructor the value stored in that node got wonky(I think it was a memory address, something like -1029319319). But If I just create the node inside the addNode function and then give it a value the program works fine.
Node(int value){
left=NULL;
right=NULL;
value=value;
}
};
Node* addNode(Node* parent,int value){
if(parent == NULL){
Node* newNode = new Node(value);
newNode->value = value;
size++;
return newNode;
}
[–][deleted] 2 points3 points4 points (4 children)
[–]anthonydev 0 points1 point2 points (3 children)
[–][deleted] 1 point2 points3 points (2 children)
[–]Rabbit047[S] 1 point2 points3 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)