vscode中while循环总报错不能解决

初学数据结构,想用链表实现多项式创建和其他操作,可以创建并返回头指针,但在while循环时总会报错segmentation fault,
void polyprint(struct poly *H){
    struct poly *p=NULL;
    poly_order(H);
    p=(struct poly *)malloc(sizeof(struct poly));
    p=H->next;
    printf("%f\n",p->next->next->c);
    if(p->next){
     while(p->next!=NULL) {
        
        printf("%f*x^%d+",p->c,p->e);
        if(p->next)p=p->next;   
    }
    }
}

img

img

img

检查了环境变量和编译器,试了for和do while循环,在循环之前和循环内试着加入了if判断是否空指针,但都不行,虽然可以打印出多项式,但总会卡住,不能运行其他的了,估计是最后一个结点没处理好,但具体的没弄明白

img

img

printf("%f\n",p->next->next->c);

这个 p->next->next 一定是非空指针么?