C语言(数据结构)链表创建问题

#include
#include//含malloc.h
#define LEN sizeof( Faction)
//一元多项式结构体
typedef struct Faction{
int coefficient;//系数
int exponent;//指数
struct Faction next;
}Faction;
//创建链表
Faction *creat() {
Faction *head, *p1, *p2;
head = NULL;
p1 = p2 = (Faction
)malloc(LEN);
scanf("d% d%", &(p1->coefficient), &(p1->exponent));
p1->next = NULL;
while(p1->coefficient != -1 || p1->exponent != -1) {
if(head == NULL)
head = p1;
else
p2->next = p1;
p2 = p1;
p1 = (Faction*)malloc(LEN);
scanf("d% d%", &(p1->coefficient), &(p1->exponent));
}
p2->next = NULL;
return head;
}
//输出链表
void Print(Faction *head) {
Faction *p;
p = head;
while(head != NULL) {
printf("d% d%", p->coefficient, p->exponent);
p = p->next;
}
}
//
int main() {
Faction *head;
head = NULL;
head = creat();
Print(head);
return 0;
}
请问为什么这段代码输入两个数之后回车会死机?

%d你写成d%了

这看起来真心乱。。。。

1>第一个malloc 那块返回值应该是Function * 型;
2> 结构体那块 next 也少个星号;

d%改成%d就可以了,代码出错误自己先检查一下啊

d%改成%d就可以了,代码出错误自己先检查一下啊