We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
for example i have got three constant array
code unsigned char a_0[]={0x54,0x25,0x11,0xff,0x21}; code unsigned char a_1[]={0x51,0x45,0x55,0x85}; code unsigned char a_2[]={0x24,0x47};
in program i want to use this costant similar this; send(a[0]); or i=2; send(a[i]);
how can i do this, all my constant have got different size
send(a[i]);
This can't work. Something has to tell this function how many bytes there are in the array you want to send. Objects of different size can't be part of the same array without wasting some memory, so you have to get the size from somewhere else.
The closest you can do is
send(a_0, sizeof(a_0))
or, slightly more complex:
struct { u8 *ptr; size_t len; } a[] = { a_0, sizeof(a_0); a_1, sizeof(a_1); a_2, sizeof(a_2); }; /*...*/ send(a[i].ptr, a[i].len)