下面代码实现(1,2,3,4,5,6,7,8,9,10)变换为(1,10,2,9,3,8,4,7,5,6),哪里出问题了?



```c
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "malloc.h"

typedef struct node{
    int data;
    struct node *next;
}NODE,*Linklist;

Linklist changlist(Linklist h){            
    NODE *p,*q,*r,*s;    
    p=q=h;
    while(q->next!=NULL){
        p=p->next;
        q=q->next;
        if(q->next!=NULL)
            q=q->next;        
        
    }
    q=p->next;
    p->next=NULL;
    while(q!=NULL){
        r=q->next;
        p->next=q->next;
        q=p->next;
        q=r;
    }
    
    s=h->next;
    q=p->next;
    
    p->next=NULL;
    while(q!=NULL){
        r=q->next;
        q->next=s->next;
        s->next=q;
        s=q->next;
        q=r;
    }
    return h;
}
    
    
void main(){
    Linklist L=(Linklist)malloc(sizeof(NODE));
    NODE *b,*a=L;
    L->data=1;
    L->next=NULL;
    int i;
    for(i=0;i<10;i++)
    {
        b=(NODE *)malloc(sizeof(NODE));
        b->data=i+2;
        a->next=b;
        a=b;
    }
    
    a->next=NULL;
    
    changlist(&L);
    
    int j;    
    for(j=0;j<10;j++)
    {
        printf("%d",L->data);
        L=L->next;

    }

}

int k;
for(k=0;k<10;k++)
{
printf("%d",L->data);
L=L->next;

}

L这里已经是链表尾了?

主函数里这么改:

    a = L;
    for (k = 0; k < 10; k++)
    {
        printf("%d ", a->data);
        a = a->next;
    }
    printf("\n");
    changlist(L);
    int j;
    a = L;
    for (j = 0; j < 10; j++)
    {
        printf("%d ", a->data);
        a = a->next;
    }

但是,Linklist changlist(Linklist h)函数里还是有问题的,没实现需要的功能。