Visual Studio错误C2226';意外类型';
我创建了一个struct数据类型,并尝试使用Visual Studio错误C2226';意外类型';,c,visual-c++,C,Visual C++,我创建了一个struct数据类型,并尝试使用realloc为这些项的列表动态分配内存,但这会导致: error C2226: syntax error : unexpected type 'Employee' 只需说:在类型说明符之前或中发生语法错误 我不知道这里出了什么问题 int current_employees=0; struct Employee *list = 0; 你可能是说 list = (struct Employee *) realloc((void*) list,
realloc
为这些项的列表动态分配内存,但这会导致:
error C2226: syntax error : unexpected type 'Employee'
只需说:在类型说明符之前或中发生语法错误
我不知道这里出了什么问题
int current_employees=0;
struct Employee *list = 0;
你可能是说
list = (struct Employee *) realloc((void*) list, current_employees * sizeof(struct Employee));
否则,您将试图用指针乘以类型。您的意思可能是
list = (struct Employee *) realloc((void*) list, current_employees * sizeof(struct Employee));
否则,您将尝试将类型与指针相乘。在该转换中缺少一些括号
list = (struct Employee *)realloc((void*) list, current_employees * sizeof(struct Employee));
那个演员阵容中缺少一些括号
list = (struct Employee *)realloc((void*) list, current_employees * sizeof(struct Employee));