Print BST keys in the given range doubt


please tell me where i am doing the mistake.

There are few mistakes in your code, plz rectify them.

  1. line no 18 : use if(root==NULL)
  2. node* insertInBST(node*root,int data), in this function plz return root, you are not returning anything.
  3. Modify your range function as :
    void inorder(node *root,int k1,int k2)
    {
    if(root==NULL)
    {
    return;
    }
    Then use the conditions similar you have used .