我声明了一个struct
,并尝试将这些结构的数组(以及一个双精度型的double
数组和一个整数)传递给一个函数。当我编译它的时候,我得到了一个“数组类型有不完整的元素类型”的消息。在将struct
传递给函数的方式中,我遇到了什么错误?
typedef struct graph_node {
int X;
int Y;
int active;
} g_node;
void print_graph(g_node graph_node[], double weight[][], int nodes);
我也尝试过struct g_node graph_node[]
,但得到的结果是一样的。
发布于 2012-04-04 08:36:58
编译器需要知道二维数组中第二维的大小。例如:
void print_graph(g_node graph_node[], double weight[][5], int nodes);
https://stackoverflow.com/questions/10003270
复制相似问题