I have declared a struct, and I try to pass an array of those structs (as well as a double array of doubles, and an integer) into a function. I get an "array type has incomplete element type" message from gcc when I compile it. What have I got wrong in how I pass the struct into the function?
typedef struct graph_node {
int X;
int Y;
int active;
} g_node;
void print_graph(g_node graph_node[], double weight[][], int nodes);
I have also tried struct g_node graph_node[]
, but I get the same thing.
The compiler needs to know the size of the second dimension in your two dimensional array. For example:
void print_graph(g_node graph_node[], double weight[][5], int nodes);
Source: Stackoverflow.com