Checking a tree is bst or not

bool isBST(node *root,int minV = INT_MIN,int maxV = INT_MAX){
if(root==NULL){
    return true;
}
if(root->data >= minV && root->data<=maxV && isBST(root->left,minV,root->data) && isBST(root->right,root->data,maxV)){
    return true;
}
return false;

}

in this code why we are doing “root->data >= minV && root->data<=maxV”?

As we know the data in the left of bst is less than equal to data of curr root and data in the right tree is greater than curr data , so when we are calling recursively , we have to check wheather curr root lies in the range or not (range that curr data should lie in) . if yes then we do call on its subtree .
In ur code there is one mistake , when u are calling on the right subtree ,the minimum value for right subtree should be root->data+1 not root->data
Hope you understood !!!