I was developing C program to read status of door access. I created a struct in which two arrays were declared. I wanted to initialize the array at the time of definition of that structure. For example,
Struct declaration in .h file:
typedef volatile struct
{
uint8_t __near const * const people_in_input_ports[8];
uint8_t __near const * const people_out_input_ports[8];
}GATE_ACCESS_CTRL_BLOCK;
Struct definition in .c file:
GATE_ACCESS_CTRL_BLOCK g_gate_acc_parameters = {
.people_in_input_ports = {&P12, &P4, &P4, &P4, &P6, &P6, &P6, &P6},
.people_out_input_ports = {&P14, &P14, &P2, &P14, &P14, &P5, &P5, &P1}
};
Here, P12, P4, P6, P5, P2 and P14 are sfr addresses of corresponding port.
I got the following error.
E0520029:Expected an expression
E0520029:Expected an expression
How to initialize arrays that are declared inside of a structure by using arrays' name?