填空题

设线性链表的存储结构如下:
struct node
{ELEMTP data; /*数据域*/
struct node *next; /*指针域*/
}
试完成下列建立单链表的算法。
creat()
{char var;
head=(struct node *)malloc(sizeof(struct node));
head->next= () ;
while((var=getchar())!=‘\n’){
ptr=( struct node *)malloc(sizeof(struct node));
ptr->data= var ;ptr->next=head->next;
head->next= ptr ;
}
}

【参考答案】

NULL