I'm trying to do something like this
typedef struct _thingy_t
{
int num;
} thingy_t;
void go(int idk)
{
// normally I could just do
thingy_t* ary[idk];
// but I need the array to be global
}
I need an array of pointers to structs of size idk
Is using a 'double pointer' declared outside of the function the best way to go about this? And what about malloc'ing space for the structs?
thingy_t *array = calloc(idk, sizeof(thingy_t));.thingy_t *array; ... void go(int idk){... array = calloc(idk, sizeof(thingy_t)); ...};and 2)thingy_t *go(int idk){... thingy_t *array = calloc(idk, sizeof(thingy_t)); ... return array;};and somewhere else:thingy_t *ar = go(size);