帮忙看看怎么会出系统错误
#define NULL 0 #include <stdio.h>
#include "malloc.h"
typedef struct polyn{
int expn;
float coef;
struct polyn *next;
int len;
} L_node, *Link_list;
void Creat_Polyn ( Link_list &L )
{
Link_list p,q;
p = ( Link_list ) malloc ( sizeof ( L_node ));
p->len = 0;
if(!p) printf("fail in malloc!");
scanf( "%f,%d",&p->coef,&p->expn);
while ( p->coef != 0 )
{
p->len++;
if ( p->len == 1 ) L = p;
else q->next = p;
q = p;
p = ( Link_list ) malloc ( sizeof ( L_node ));
scanf( "%f,%d",&p->coef,&p->expn);
}
p->next = NULL;
}
void Display_Polyn ( Link_list p )
{
if ( !p ) printf ( " error! " );
while ( p->next )
{
printf ( "%f * exp %d \n",p->coef,p->expn );
p = p->next;
}
printf ( "%f * exp %d \n",p->coef,p->expn );
}
void main()
{
Link_list Pa,Pb,Pc;
Creat_Polyn (Pa);
Display_Polyn (Pa);
Creat_Polyn (Pb);
Display_Polyn (Pb);
}
我做的这个CREAT功能是一直输入,直到输入为0,表示结束.
但是每次输入0,再调用DISPLAY以后都会出现WINDOWS的错误.
(那种问我是否发送报告的对话框)