I made this program to create a binary search tree but it is not working properly ......could smbdy tell me whts the prob
/* Creating a BInary Tree */
#include<conio.h>
#include<stdio.h>
struct node
{
struct node *lt;
struct node *rt;
int data;
}*temp;
void inorder(struct node* root)
{
while(root != NULL)
{
inorder(root->lt);
printf(" %d",root->data);
inorder(root->rt);
}
}
void main()
{
struct node *root,*New;
char ch;
// int num;
clrscr();
root= NULL;
do
{
New = (struct node*)malloc(sizeof(struct node*));
New->lt = NULL;
New->rt = NULL;
printf("\nEnter the node:");
scanf("%d",&New->data);
if(root == NULL)
root = New;
else
{
temp = root;
while(1)
{
if(New->data < temp->data)
{
if(temp->lt == NULL)
{
temp->lt = New;
break;
}
else
temp = temp->lt;
}
else
{
if(temp->rt == NULL)
{
temp->rt = New;
break;
}
else
temp = temp->rt;
}
}
}
//free(New);
printf("DO u want to continue(y/n):");
flushall();
scanf("%c",&ch);
}while(ch == 'y' || ch == 'Y' );
inorder(root);
getch();
}