0

I have an array (let's call it RateT) of the following structure which gets filled after being read from disc.

/* tabulated rates */
typedef struct
{
  double Temperature, LAMBDA, townY;
  double townY_inv, Temperature_invY;
} RateTable;

I create an array of RateTable using the following.

RateTable* RateT = (RateTable *) malloc( NCOOLTAB * sizeof(RateTable));

Now in a different function (say double Lambda(double* Temperature)), I wish to pass an array that is made from say all the Temperature elements from each of the members of RateT array. Is there a neat and concise way to pass that as an argument to the function?

curious
  • 11
  • 3
  • 3
    No it's not really possible. You need to create a brand new array, and copy from each structure into the new temperature array in a loop. – Some programmer dude May 22 '21 at 06:18
  • 2
    By the way, in C you don't need to (and really shouldn't) [cast the result of `malloc`](https://stackoverflow.com/questions/605845/do-i-cast-the-result-of-malloc). – Some programmer dude May 22 '21 at 06:19

0 Answers0