VS编译没问题,生成的文件执行就出错

#include
#include
typedef struct lNode
{
int xi;
int zhi;
struct lNode *next;
}*Lnode;//多项式节点
typedef struct
{
Lnode head;
int length;
}*Linklist;

/*-------------------------------------多项式相加主要函数的实现--------------------------*/

int InitList(Linklist &L)
//建立一个空的多项式
{
L = (Linklist)malloc(sizeof(Linklist));
if (L == NULL)return ERROR;
L->head = NULL;
L->length = 0;
return OK;
}
#include"标头.h"

void main()
{
int m = 0;
Linklist La = NULL;
printf("请输入多项式La的项数:");
scanf_s("%d", &m);
int result = 0;
Lnode P =NULL;
result = InitList(La);
if (result)
for (int i = 1; i <= m; i++)
{
int x, y;
P = (Lnode)malloc(sizeof(Lnode));

        printf("请依次输入系数和指数:");
        scanf_s("%d%d", &x, &y);
        P->xi = x; P->zhi = y;
        Lnode D = La->head;
        if (i == 1)
        {
            P->next = D;
            La->head = P;
            (La->length)++;
        }break;
        for (int j = 2; j <i; j++)
        {
            D = D->next;
        }
        P->next = D->next;
        D->next = P;
        (La->length) += 1;  break;
    }



system("pause");

}
输入x和y后就显示停止工作,但调试却没问题

1、有两个break使用错误; 没看出来你要干什么用,执行到这就退出了。
2、
L = (Linklist)malloc(sizeof(Linklist));
P = (Lnode)malloc(sizeof(Lnode));
一般是:
P = (Lnode)malloc(sizeof(lNode));
求结构体的字节数,返回指针,很少求指针的字节数的。

P = (Lnode)malloc(sizeof(Inode));