printf("%d",ch) instead of printf("%c",ch)
then the loop is infinte before running for once and asking for the value of ch variable and keeps repeating the menu section of the code.
and if I use
printf("%c",ch)
then while debugging i see that ch contains \n instead of y while checking with the do-while loop.
Code:
int main()
{
int i,j;
char ch='y';
do
{
printf("\t\t*** Menu************\n");
printf("\t1.Create \n\t2.Delete \n\t3.Search\n\t4.Add the element\n\t5.Display Tree\n\t6.exit\n");
printf("Enter ur choice:\t");
scanf("%d",&i);
switch(i)
{
case 1:
create_tree();
break;
case 2:
printf("Enter the node to be deleted :\t");
scanf("%d",&j);
delete_tree(j);
break;
case 3:
printf("\nenter the element :\t");
scanf("%d",&j);
search(j);
break;
case 4:
printf("\nEnter the element to be added:\t");
scanf("%d",&j);
add(j,root);
break;
case 5:
display(root);
break;
case 6:
exit(0);
} //switch ends here
printf("\n If wish to continue, press 'y' :\t");
scanf("%d",&ch); // if %c is used instead of %d,ch is not taken and do while is exited
}while( ch=='y'); //do while ends here
exit(0);
}



