Plz check what is the error

Two errors in your code:
At line 36 , it should be k==0 instead of 1
At line 28 , add
else
{
root->left = buildTree();
}
Also , as you have used static, i would mention to read little bit theory of static keyword as it can be asked why is it used.
Rest everything is correct in your code.