I want to allocate space for an array of pointers to structs so here is what I did.
typedef struct A_example{ struct B_example* B_array[MAX_SIZE]; } A typedef struct B_example{ int a; }B A A_array[MAX_SIZE2]; so to allocate memory for B_Array for an element of A_array I do this:
A_array[current_element].B_array[i] = (struct B_example*)malloc(sizeof(struct B_example)); is this correct? and how should I free the memory for this?