#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
struct node{
int item;
struct node *left;
struct node *right;
};
struct node build()
{
struct node ptr;
int data;
printf(“enter data\n”);
scanf("%d",&data);
if(data==-1)
return NULL;
ptr=(struct node)malloc(sizeof(struct node));
ptr->item=data;
printf(“enter data at the left child of %d\n”,ptr->item);
ptr->left=build();
printf(“enter data at the right child of %d\n”,ptr->item);
ptr->right=build();
return ptr;
}
void print(struct node *ptr)
{
if(ptr!=NULL)
{
printf("%d \n",ptr->item);
print(ptr->left);
print(ptr->right);
}
}
int main()
{
struct node *ptr;
printf(“BUILD YOUR BINARY TREE\n”);
ptr=build();
printf(“BINARY TREE\n”);
print(ptr);
return 0;
}
bhaiya I am getting error in printing tree