跪求C语言大神解决链表有关问题。对链表排序后输出。没有结果,不知道错哪了

跪求C语言大神解决链表问题。对链表排序后输出。没有结果,不知道哪里错了
#include<stdio.h>
#include<stdlib.h>
struct num
{
int k;
struct num*next;
};
main()
{
int n,a,b;
struct num *head=NULL,*current=NULL,*last=NULL,*point=NULL,*change=NULL,*point1=NULL,*point2=NULL;
printf("Please input a list of numbers:");
scanf("%d",&n);
printf("The result is:");
while(n!=-1)
{
current=(struct num*)malloc(sizeof(struct num));
if(current!=NULL)
{
current->k=n;
if(head==NULL)
{
head=current;
last=current;
}
else
{
last->next=current;
last=current;
}
}
    scanf("%d",&n);
}
last->next=NULL;


point2=head;
while(point2!=NULL)
{
a=point2->k;
point1=point2;
b=point1->k;
point2=point2->next;
if(a>b)
{
change=point1;
point1=point2;
point2=point1;
}
}



point=head;
while(point!=NULL)
{
printf("%d ",point->k);
point=point->next;

}


while(head!=NULL)
{
point=head;
free(point);
head=head->next;
}
return 0;

------解决方案--------------------
另外这样做会出现错误的。
point=head;
free(point);
head=head->next;

第三句跟第二句应该调换一下顺序

排序应该这样写
point2=head;
while(point2 !=NULL)
{
point1 = point2->next;
while(point1 != NULL)
{
a=point2->k;
b=point1->k;
printf("a= %d,b = %d\n",a,b);
if(a>b)
{
temp=point1->k;
point1->k=point2->k;
point2->k=temp;
printf("change!\n");
}
point1 = point1->next;
}
point2 = point2->next;
}
------解决方案--------------------
分呢~亲?跪求C语言大神解决链表有关问题。对链表排序后输出。没有结果,不知道错哪了