链表的冒泡排序问题请教

可以帮我看下这个冒泡排序有什么问题吗,在VS上运行不出来


//冒泡排序
void BubbleSort(Student* L)
{
    Student* p=NULL, * q=NULL, * pre = L;
    int count = 0;//学生数(结点数)
    p = L->next;
    while (p)
    {
        count++;
        p = p->next;
    }
    printf("1.represent the chinese:\n");
    printf("2.represent the math:\n");
    printf("3.represent the english:\n");
    int item;
    printf("you choose subject:");
    scanf_s("%d", &item);
    switch (item)
    {
    case 1:
    {
        while (--count)//控制调序次数
        {
            p = L->next;
            q = L->next->next;
            while (p && q)//相邻元素进行比较
            {
                if (p->chinese < q->chinese)//若前者p小于后者q,则二者交换次序,同时前移pre指针(使整体比较向前进)
                {
                    p->next = q->next;
                    pre->next = q;
                    q->next = p;
                    q = p->next;
                    pre = pre->next;
                }
                else//若前者不小于后者,这将pre,p,q三指针均后移
                {
                    pre = p;
                    p = p->next;
                    q = q->next;
                }
            }
        }
        break;
    }
    case 2:
    {
        while (--count)
        {
            p = L->next;
            q = L->next->next;
            while (p && q)
            {
                if (p->math < q->math)
                {
                    p->next = q->next;
                    pre->next = q;
                    q->next = p;
                    q = p->next;
                    pre = pre->next;
                }
                else
                {
                    pre = p;
                    p = p->next;
                    q = q->next;
                }
            }
        }
        break;
    }
    case 3:
    {
        while (--count)
        {
            p = L->next;
            q = L->next->next;
            while (p && q)
            {
                if (p->english < q->english)
                {
                    p->next = q->next;
                    pre->next = q;
                    q->next = p;
                    q = p->next;
                    pre = pre->next;
                }
                else
                {
                    pre = p;
                    p = p->next;
                    q = q->next;
                }
            }
        }
        break;
    }
    }
    ShowList(L);//输出已排序链表
}