我的代码如下,问题也在下面解释为什么lvalue会发生;
typedef struct test_item
{
char id[MENU_NAME_LEN + NULL_SPACE];
MenuFunction function;
} test_item;
Run Code Online (Sandbox Code Playgroud)
和
typedef void (*MenuFunction)(VmSystem *);
Run Code Online (Sandbox Code Playgroud)
和
void display(VmSystem * system)
{
printf("test");
}
Run Code Online (Sandbox Code Playgroud)
我能够为我分配ID,但是当我尝试分配函数指针时,我得到以下错误lvalue作为一元&操作数
test_item test;
test.function = &display(system);
Run Code Online (Sandbox Code Playgroud) c ×1