我写一个程序,其中我不得不结构指针数组传递给一个函数在主体如下传递结构指针的数组的函数
struct node *vertices[20];
create_vertices (&vertices,20);
执行功能是这样一些事
void create_vertices (struct node *vertices[20],int index)
{
}
在此
我要通过结构的指针数组与索引20, 声明我没有外部电源被如下我
void create_vertices(struct node **,int);
但是每次编译代码给了我问题,这三条线仅作为
bfs.c:26:6: error: conflicting types for ‘create_vertices’
bfs.c:8:6: note: previous declaration of ‘create_vertices’ was here
bfs.c: In function ‘create_vertices’:
bfs.c:36:15: error: incompatible types when assigning to type ‘struct node’ from type ‘struct node *’
我无法理解我应该怎么做这个。 我想要做的是:
- 声明main(我已经做过)中的结构指针数组。
- 将数组的地址传递给函数(这里是我疯狂的地方)。
- 声明市电外功能的正确原型。
代码必须在C上,我正在Linux上测试它。 有人可以指点我吗?
很好的解释+1对于上面的某个人写代码,因此接受他的答案。 –