Go ahead and declare as you suggest:
struct A;
typedef void (*func_t)(struct A*);
struct A
{
func_t functionPointerTable[10];
};
For instance:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct A;
typedef void (*func_t)(struct A*);
struct A
{
func_t functionPointerTable[10];
int value;
};
void print_stdout(struct A* a)
{
printf("stdout: %d\n", a->value);
}
void print_stderr(struct A* a)
{
fprintf(stderr, "stderr: %d\n", a->value);
}
int main()
{
struct A myA = { {print_stdout, print_stderr}, 4 };
myA.functionPointerTable[0](&myA);
myA.functionPointerTable[1](&myA);
return 0;
}
Conclusion:
stdout: 4
stderr: 4
Watch the online demo at http://ideone.com/PX880w .
, :
typedef struct A struct_A;
typedef struct A, struct.