struct a
{
int (*ptr1)();
int (*ptr2)();
int data;
};
typedef struct
{
struct a x;
}all;
int fun1()
{
return 5;
};
int fun2()
{
return 9;
};
I can assign like
all *mem = (all*)malloc(sizeof(all));
mem->x.ptr1 = fun1;
mem->x.ptr2 = fun2;
Is there any other way to assign these function pointers? Is it possible to assign like this?
all *mem;
(void **)mem->ptr1[0] = fun1;
(void **)mem->ptr2[1] = fun2;