I'm being passed a pointer to a struct, and the first 8 members are the same size, can I access them by index?
typedef struct example{
uint64_t one;
uint64_t two;
uint64_t three;
uint64_t four;
uint64_t five;
//etc...
uint8_t ninth;
} example_t;
void example_method(example_t *ptr)
{
//can I do this?
&ptr[2] // which would be equal to the uint64_t third?
}
unionof an array and the substructure (with some caveats about that, too). It is best to design the structure to match the use patterns — if you're going to need to treat it as an array, store it as an array.