I am using software with predefined functions and the function creates an array and that array I am trying to return.
I was wondering if this logic will return the array to be able to use in RunTest?
header file
Code:
struct Data{
double mData[50];
int size;
};
struct Data cMeas;
c file
Code:
int RunTest(x,y,z...)
{
double *mData;
int size;
//Run Test
mData = StartTest();
size = sizeof mData / sizeof mData[0];
for (int index = 1; index < cMeas.size; index++)
{
..........
...........
............ cMeas.mData[index-1];
}
return 0;
}
double *StartTest(void)
{
.......
.......
double *mData = malloc(50*sizeof(double));
......
......
functionReturnsArray(x,y,cMeas.mData,z); //functions takes in values and stores in array
return cMeas.mData;
}