This is how I allocate in main:
And in function:Code:Ax r = (Ax)malloc(nr*sizeof(Tx));
Ax is a pointer to a struct;Code:void* r = (void*)malloc(nr*d)
d = sizeof(Tx);
The function will return the "r" for which it is supposed to allocate memory.