/*Add a new node to the top of the list*/
firstlist *insert_top(char entry->name, char entry->address, int entry->phone, firstlist*head)
{
firstlist *new_node;
new_node=(firstlist*)malloc(sizeof(firstlist));
new_node->name=entry->name;
new_node->address=entry->address;
new_node->phone=entry->phone;
new_node->next=head;
head=new_node;
return head;
}
我在第24行出现以下错误:错误]应为";",","或标记前的"(">
https://pastebin.com/LsNwAgQE
希望你们能帮忙。
您需要从insert_top
函数定义中删除entry->name
。
有两种方式可以通过入口。作为一个结构:
firstlist *insert_top(firstlist *entry, firstlist*head)
然后可以使用entry
成员,如entry->name
稍后再调用:
head=insert_top(entry, head);
另一个选项是使用单独的值:
firstlist *insert_top(char name, char address, int phone, firstlist *head)
在这一点上,您不能使用entry->name
,因为您的函数不知道谁是条目,只需使用name
在此选项中调用insert_top
与您所做的操作相同:
head=insert_top(entry->name, entry->address, entry->phone, head);