I have the following files in my program, a header with certain function definitions, and a program with the body of the functions.
something.h
typedef struct _foo {
int id;
int lucky_number;
} foo;
typedef void (*pointer_fc)(foo *);
void first(foo *);
void second(foo *);
void third(foo *);
extern pointer_fc fc_bases[3];
something.c
pointer_fc fc_bases[] = {first, second, third};
/* body of functions */
Note that in the header I had defined an array of pointers to functions, and in the something.c
program, the functions are associated with every element of the array.
Let's suppose in certain moment I need in the main.c
program to call all 3 functions. With this, how I can use the extern array of pointers to call this functions in my main.c
.