Lets pretend I have a struct like this..
typedef struct _my_struct {
int a;
int b;
} my_struct;
Now if I did something like this..
my_struct data[20];
Would give me an array of 20 structs which I can access by doing..
data[0].a = 5;
data[5].b = 10;
etc..
However, what if I don't know the number that I need at compile time? So then I do something like..
my_struct *data = malloc(sizeof(my_struct) * 20);
The issue is now I don't know how to reference each struct in this buffer of memory.