I declare and initialise a global array of my structures in one file, then I want to get at that array in another file.
First file (The initialising part):
Code: Select all
...
typedef struct {
int Obj_ID;
int Obj_Status;
} Obj;
Obj Obj_Array[] = {{5,1}};
...
Code: Select all
typedef struct {
int Obj_ID;
int Obj_Status;
} Obj;
extern Obj *Obj_Array;
...
In a function
fprintf(stderr, "%d", Obj_Array[0].Obj_ID);
Any chance one of the C gurus could tell me what I'm doing wrong? It's probably something silly.