این کد مشکلش چیه ؟
struct node *createTree(struct node *root)
{
int n;
char ch;
struct node *t1;
t1=(struct node *)malloc(sizeof(struct node));
printf("Enter Element\n");
scanf("%d",&n);
if(root==NULL)
{
t1->data=n;
t1->left=NULL;
t1->right=NULL;
root=t1;
}
printf("do you want to add node at left?\n");
scanf("%c",&ch);
if(ch=='y')
{
t1->left=createTree(t1->left);
}
printf("do you want to add node at right?\n");
scanf("%c",&ch);
if(ch=='y')
{
t1->right=createTree(t1->right);
}
اون scanf دومم بعضی وقت ها کار نمی کنه !!! خیلی عجیبه