Print BST elements in given range

vector printNearNodes(Node *root, int low, int high)
{

vector vp;

if(root->data>=low)
printNearNodes(root->left,low,high);
if(root->data>=low && root->data<=high)
{
vp.push_back(root->data);
}
printNearNodes(root->right,low,high);

return vp;
}

what would be the case base
please help me, I don’t want more function, i want this function should be sufficient

hello @mkjha the base case in this should be :
if(root==NULL){
Node*root=new Node(d);
return root;
}
if you have any other doubt please let me know .
Happy Learning !!

i think, you did not understand my question ,please read the question again

@mkjha the base case is very simple i.e if you encounter any null node then you have to simply return .
if(root==NULL){
return;
}
Happy Learning !!

in this function it returns vector value ,return NULL value is not possible .it gives compiler error

there is no need to prepare vector and return vector you can simply make the function of the type void .
and you can compare on the range if it is in the range then cout the data at that time only .