标题:帮忙看看怎么会出系统错误
只看楼主
tcxiang
Rank: 1
等 级:新手上路
帖 子:22
专家分:0
注 册:2007-10-14
 问题点数:0 回复次数:0 
帮忙看看怎么会出系统错误
#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的错误.
(那种问我是否发送报告的对话框)
搜索更多相关主题的帖子: 系统 list len Link 
2008-03-05 12:17



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-202031-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.306573 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved