填空題

設線性鏈表的存儲結構如下:
struct node
{ELEMTP data; /*數(shù)據(jù)域*/
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
微信掃碼免費搜題