Compiling simple c program on arm platform.
typedef struct
{
char* Case;
int RespCmdLen;
unsigned char *RespCommand;
}ResponseStruct;
int main()
{
unsigned char CommandResp[] = {
0x01,
0x08, 0x07,
0x05, 0x00,
0x00,
0x00,
0x0B,
0x00,
0x00,
};
ResponseStruct CaseRespTbl[] =
{
/* case, Response length, response buffer pointer */
{ "case1", sizeof(CommandResp), CommandResp},
};
return 0;
}
and got error like
Error: #24: expression must have a constant value
{ "case1", sizeof(CommandResp), CommandResp},
^
But if i change that code to
ResponseStruct CaseRespTbl[10];
CaseRespTbl[0].Case = "case1";
CaseRespTbl[0].RespCmdLen = sizeof(CommandResp);
CaseRespTbl[0].RespCommand = CommandResp;
Then it will compiled without any issue.
Any reason for that?