What is the mistake in my code?
Replace line 33 and 34 with
if(root1==NULL && root2==NULL)
return true;
You are not returning true in any case so your function will always give result as false
Replace line 33 and 34 with
if(root1==NULL && root2==NULL)
return true;
You are not returning true in any case so your function will always give result as false