I've been searching all day but I can't find the one that can do what I'm looking for. I'm trying to find a way to create an array of pointers.
Like the Tree data structure, but instead of just left and right pointers I want to create a expandable array that I can store many pointers. Is there a way to do this?
struct Test{
char label[100];
float fear;
float anger;
float disgust;
float sad;
float happy;
float surprise;
struct Test *connect[];
};
I included my struct above, so what I want is the connect to be able to expand anytime I need it and at the same time store pointers to other Tests.
I tried using malloc but it seems like I'm not doing it right, here's my attempt:
typedef struct Test test;
In the function (*tst)->connect = malloc(sizeof(test));
size_t n_connect;andstruct Test **connect;members would be sufficient. Obviously somecallocandreallocmanagement would be in order to maintain those members.