所以我在 C 中使用/取消引用双指针时遇到问题。它给了我对成员*的错误消息请求,而不是结构或联合。现在,我看到很多类似问题的帖子,但是,解决方案喜欢做(*head)
和head = &temp
不工作。有人可以帮我吗?
vertex_t **create_graph(int argc, char *argv[]) {
vertex_t **head, *temp;
temp = malloc(sizeof(vertex_t));
head = head->temp;
head->name = argv[1];
head->next = malloc(sizeof(vertex_t));
head->next->name = argv[2];
head->next->next = 0;
head->adj_list = malloc(sizeof(adj_vertex_t));
head->adj_list->edge_weight = atoi(argv[3]);
head->adj_list->vertex = head->next;
head->next->adj_list = malloc(sizeof(adj_vertex_t));
head->next->adj_list->edge_weight = atoi(argv[3]);
head->adj_list->vertex = head;
return head;
}