填空题

设线性链表的存储结构如下: 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 ; } }

正确答案

来源:www.examk.com

答案解析