You do not set a value to BST::root
after creating obj_bst
. Thus obj_bst.getBSTRoot()
returns an invalid pointer on which you call setVal
which causes a crash.
solved Don’t understand the output of the given code [closed]
You do not set a value to BST::root
after creating obj_bst
. Thus obj_bst.getBSTRoot()
returns an invalid pointer on which you call setVal
which causes a crash.
solved Don’t understand the output of the given code [closed]