Suppose I have functions:
void func1(int x)
{
....
}
void func2(int x, int y)
{
....
}
void func3(int x, int y, int z)
{
....
}
And say that I want to have a function pointer within a struct:
For example
typedef struct{
char *ename;
char **pname;
< and here I want to have a function pointer> ??
} Example;
Example ex[3];
Now, I want to populate the ex[3] array as:
ex[0].ename = "X0";
ex[0].pname[0]="A0";
ex[0].pname[1]="B0";
ex[0].<function pointer to func1() > ??
ex[1].ename = "X1";
ex[1].pname[0]="A1";
ex[1].pname[1]="B1";
ex[1].<function pointer to func2() > ??
... and so on...
Is it possible to create something like this? Please help me with this. Thanks.