我可以先给void * 分配一个 struct (里面有一个函数),然后触发它们里面的函数吗?
struct func {
void (*fp)(); // this is a function
};
struct thread{
void *stack; // I'm gonna use this to store 'struct func' above
};
void assign(struct thread *t,void *f()){
struct func *task = (struct func *)malloc(sizeof(struct func));
task->fp = f;
t->stack = task;
// question: now I want to call the function inside func and deeper inside void*
// I mean: trigger the function fp()
t->stack->fp(); // error here
}