刚学链表,很郁闷,错误为: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);
}
链表中的floating point...错误-HELP