当前位置: 代码迷 >> C语言 >> 链表中的floating point...错误-HELP
  详细解决方案

链表中的floating point...错误-HELP

热度:878   发布时间:2006-03-11 15:58:00.0
链表中的floating point...错误-HELP

刚学链表,很郁闷,错误为:scanf : floating point formats not linked
Abnormal program terminate
请大家关照,万分感激: 下面是程序

#include <malloc.h>
#define len sizeof(struct Node)
struct Node{
int M;
float N;
struct Node *next;
};

struct Node *Create(int n){
struct Node *h,*p;
int i;
h=(struct Node*)malloc(len);
h->next=0;
for(i=1;i<=n;i++)
{
p=(struct Node*)malloc(len);
printf("Node.M=");
scanf("%d",&p->M);
printf("Node.N=");
scanf("%f",&p->N);
printf("/n");
p->next=h->next;
h->next=p->next;
}
return h;
}

void print(struct Node* h){
struct Node *p;
p=h->next;
if(!p) printf("The Node list Is Empty!!");
else { printf("The Node list are:\n");
while(p){
printf("Node_M: %d : Node_N: %f ;\n",p->M,p->N);
p=p->next;
}
}
}
main()
{
int n;
struct Node *h;
printf("Input the Number of the NodeTree You want to Create:\n");
scanf("%d",&n);
h=Create(n);
print(h);
}

搜索更多相关的解决方案: 链表  point  floating  HELP  

----------------解决方案--------------------------------------------------------
http://bbs.bc-cn.net/bbs/dispbbs.asp?boardid=5&id=21391

下,第一点
----------------解决方案--------------------------------------------------------
晕,你老是推销你的作品
----------------解决方案--------------------------------------------------------
好东西,很实用,非常感谢。
----------------解决方案--------------------------------------------------------
  相关解决方案