如果我有一个结构,它有一个指向这样的函数的指针
struct str{
int some_element;
char other_element;
int (*my_pointer_to_a_function)(int);
};
struct str my_struct;
int my_function(int);
我给它赋值
my_struct.some_element = 1;
my_struct.other_element = 'a';
my_struct.my_pointer_to_a_function = my_function;
如何调用指针指向的函数(使用指针)?我最初的猜测是这样的:
my_struct.(*my_pointer_to_a_function)(value);
或者应该是
*my_struct.my_pointer_to_a_function(value);
?
谢谢你。