The easiest way is to use the STL container
std::vector
. I will assume that is not an option since you are asking this question. Here is one way to do it, assuming the data is of type double.
const int ArraySize = 10;
typedef double Array[ ArraySize ];
typedef struct structArrayStr
{
int Size;
Array Data;
} ArrayStr;
Now you can declare an instance of an
ArrayStr
, initialize it, and pass it by reference to a your function.
Alternatively, you don't have to use the structure at all. You can pass the array and its size to the function as separate parameters.