用顺序表实现两个多项式的合并,但是执行不出来,应该怎么解决呀?

问题遇到的现象和发生背景

用顺序表实现两个多项式的合并

问题相关代码,请勿粘贴截图

#include<stdio.h>
#include<stdlib.h>
#define LIST_INIT_SIZE 3
#define LISTSIZE 2
typedef struct {
int coef;//系数
int expn;//指数
}poly;
typedef struct {
poly* elem;//存储空间基址
int listsize;//当前容量
int length;//当前长度
}SqList;
void InitList(SqList* L)//初始化
{
(L).elem = (poly)malloc(LIST_INIT_SIZE * sizeof(poly));
if (!(*L).elem)exit(-1);
(*L).length = 0;
(*L).listsize = LIST_INIT_SIZE;
}
void Input(SqList L)//输入
{
int n;
printf("请输入项的个数:");
scanf_s("%d",&n);
for (int i = 0; i < n;++i)
{
printf("请输入第%d项的系数:",i+1);
scanf_s("%d", &L.elem[i].coef);
printf("请输入第%d项的指数:",i+1);
scanf_s("%d", &L.elem[i].expn);
}
}
void Display(SqList L)//打印
{
for (int i = 0; i < L.length; i++)
{
printf("+%d",L.elem[i].coef);
printf("X^");
printf("%d", L.elem[i].expn);
}
printf("\n");
}
void MergeList(SqList La, SqList Lb, SqList * Lc)//归并
{
(*Lc).elem = (poly*)malloc(LIST_INIT_SIZE * sizeof(poly));
(*Lc).length = 0;
(*Lc).listsize = (*Lc).length = La.length + Lb.length;
poly* pa = La.elem; poly* pb = Lb.elem; poly* pc = (*Lc).elem;
if (!(*Lc).elem)exit(-1);//存储分配失败
poly* pa_last = La.elem + La.length-1;
poly* pb_last = Lb.elem + Lb.length - 1;
while (pa<=pa_last&& pb <=pb_last) {
if (pa->expn < pb->expn) {
pc->coef = pa->coef; pc->expn = pa->expn;
pa++; pc++; (*Lc).length++;
}
else if (pa->expn > pb->expn) {
pc->coef = pb->coef; pc->expn = pb->expn;
pb++; pc++; (*Lc).length++;
}
else if (pa->expn = pb->expn)
{
if (pa->coef + pb->coef != 0)
{
pc->coef = pa->coef + pb->coef; pc->expn = pa->expn;
pc++; (*Lc).length++;
}
pa++; pb++;
}
}
while (pa <= pa_last )
{
pc->coef = pa->coef; pc->expn = pa->expn;
pa++; pc++; (*Lc).length++;
}
while (pa <= pa_last)
{
pc->coef = pb->coef; pc->expn = pb->expn;
pb++; pc++; (*Lc).length++;
}
}
int main()
{
SqList la, lb, lc;
printf("请输入第一个多项式:\n");
InitList(&la);
Input(la);
printf("请输入第二个多项式:\n");
InitList(&lb);
Input(lb);
MergeList(la, lb, &lc);
Display(la);
Display(lb);
printf("归并后的多项式为:\n");
Display(lc);
}

运行结果及报错内容

输入正常,但输出执行不出来

我的解答思路和尝试过的方法

改为地址传递,但是不行

我想要达到的结果

完成两个多项式的合并