You put the declaration in the header, the definition inside a .c file and the call to malloc in a function that gets executed before the first time you dereference the pointer (like the main function for example). So it will look something like this:
foo.h:
extern struct your_struct** pointer;
void foo_init();
void foo_cleanup();
foo.c:
#include <stdlib.h>
#include "foo.h"
struct your_struct** pointer;
void foo_init() {
pointer = malloc(sizeof(your_struct*) * some_size);
// initialize the pointer in the array
}
void foo_cleanup() {
// free the pointers in the array if you used malloc to initialize them
free(pointer);
}
main.c:
#include "foo.h"
int main() {
foo_init();
// do other stuff
foo_cleanup();
return 0;
}