链表的用scanf不能赋值
我的链表为什么不能全部赋值?#include<malloc.h>
#define L sizeof(struct stu)
struct stu
{
long num;
float score;
struct stu *head;
};
main()
{
struct stu *p1,*p2,*p3;
p1=(struct stu *)malloc(L);
p2=(struct stu *)malloc(L);
p3=(struct stu *)malloc(L);
scanf("%ld,%f",&p1->num,&p1->score);
scanf("%ld,%f",&p2->num,&p2->score);
scanf("%ld,%f",&p2->num,&p2->score);
printf("\n\n%ld,%f\n",p1->num,p1->score) ;
printf("%ld,%f\n",p2->num,p2->score) ;
printf("%ld,%f\n",p3->num,p3->score) ;
}
程序中,scanf的应用输入一组数据回车后,屏幕自动关闭。为什么呢?