objective c - Array of uint8_t arrays -


i have 4 uint8_t arrays:

uint8_t arrayone[12]   = { 0x00,0x01,0x00,0x00,0x00,0x06,0xfe,0x03,0x01,0xc1,0x00,0x01 };  uint8_t arraytwo[12]   = { 0x00,0x01,0x00,0x00,0x00,0x06,0xfe,0x03,0x4e,0x2d,0x00,0x0c };  uint8_t arraythree[12] = { 0x00,0x01,0x00,0x00,0x00,0x06,0xfe,0x03,0x01,0xf3,0x00,0x01 };  uint8_t arrayfour[12]  = { 0x00,0x01,0x00,0x00,0x00,0x06,0xfe,0x03,0x20,0x04,0x00,0x01 }; 

and want them add array:

uint8_t thearray[4][12] = { arrayone,arraytwo,arraythree,arrayfour }; 

but values of arrays change when add them thearray.

why? how add them array properly?

the toplevel array should array of pointers:

uint8_t *thearrays[] = { arrayone,arraytwo,arraythree,arrayfour }; 

you lose information lengths of each "row", that's fine.

i don't think can reference array in initializer in example , have elements copied larger array automatically.


Comments