Hi,
Simple but driving me nuts.
I am trying to create a table of pointers to already defined structures. But I can't find correct directions and I'm not used to this so HELP pliz!
I managed to do it for functions, for some reason I can't find how to do it for structs.
Imagine I have
struct a
{
uint8_t a1;
uint16_t a2;
}
struct b
{
...
}
struct c
{
...
}
I also have 3 defines of indexes which will allow me to get the right structure I need using the table (array):
#define TYPEA 1
#define TYPEB 2
#define TYPEC 3
Now what should the typedef (if I even need one), something like:
typedef (*my_struct) ... ?;
And is the table :
const my_struct my_table[]=
{
[TYPEA] = (my_struct)a;
[TYPEB] = (my_struct)b;
[TYPEC] = (my_struct)c;
}
???
I'm still learning the intricate C ways so please give me a hand :)
Bye
T-