Getting segmentation error


getting segmentation fault for the value which are not present in BST

if(root==NULL)
        return false;

this condition should come at top
because it is not at top
then compiler execute

if(root->data==key)
    return true; 

this first and if root==NULL then NULL->data will give you segmentation fault

if you have more doubts regarding this feel free to ask
i hope this helps
if yes hit a like and don’t forgot to mark doubt as resolved :grinning: