按从小到大在链表中插入元素
struct node *insert(struct node *head,int x){struct node *p=head,*h;
while(p->next)
{
if(x<p->next->num)
{ h=(struct node*)malloc(sizeof(struct node));
h->num=x;
h->next=p->next;
p->next=h;
}
else
p=p->next;
}
free(h);
return head;
}
各位大虾帮我看看哪里有问题