这个代码哪里问题啊哪位能帮我改一改啊

#include
#include
struct node
{
int data;
struct node *next;
};
struct node *creat(int n)
{
int i;
struct node *head,*p,tail;
head=(struct node)malloc(sizeof(struct node));
head->next=NULL;
tail=head;
for(i=0;i{
p=(struct node*)malloc(sizeof(struct node));
scanf("%d",&p->data);
p->next=NULL;
tail->next=p;
tail=p;
}
return head;
}

struct node *merge(struct node *head1,struct node *head2)

{
struct node *p1,*p2,*tail;
p1=head1->next;
p2=head2->next;
tail=head1;
free(head2);
while(p1&&p2)
{
if(p1->datadata)
{
tail->next=p1;
tail=p1;
p1=p1->next;
}
else
{
tail->next=p2;
tail=p2;
p2=p2->next;
}
}
if(p1)tail->next=p1;
else tail->next=p2;
return head1;
}

int main()

{
int n,m;
struct node *head1,*head2,*p;
scanf("%d",&m);
head1=creat(m);
scanf("%d",&n);
head2=creat(n);
head1=merge(head1,head2);
p=head1->next;
while(p)
{
printf("%d ",p->data);
p=p->next;
}
return 0;
}