I'm trying to initialize an empty 2 dimensional array of pointers that point to data structures I have created known as "node"s. For some reason, I'm getting this scoping issue when I'm trying to modify the list, which is a crucial part of the program. A function called "repository_init" is supposed to truly initialize the array. However, I am using the array in other functions, which is why I'm getting the error. It doesn't recognize that the array exists. I'm new to C but after doing some research I found something on "extern", and the site told me that I could use extern to declare an empty variable. So, I declared my list as a global variable by putting it before main and writing it like so:
extern node *main_list[][];
#define MAX_LEVEL 10000
Here is the repository_init() function:
void repository_init(int p){
int new;
new = (max_range/2) + 5;
max_height = 1;
while(new > 1){
new = (new * probability)/100;
max_height++;
}
main_list[max_height][MAX_LEVEL];
/*fill the array with empty values*/
}
The error output to the screen is "error: array type has incomplete element type
extern node *main_list[][];"
I need this list to be global. I don't see what the problem is with just having the array initialized in a separate function. I've done this tons of times in other languages.