S
steflhermitte
Dear cpp-ians,
I am working with a structure:
struct meta_segment
{
long double id;
long double num;
long double mean;
bool done;
};
but I want to store multiple elements for some of the elements of my
structure. I was thinking of using arrays in my structure. E.g., when I
have 5 elements for 'num' and 'mean':
struct meta_segment
{
long double id;
long double num[5];
long double mean[5];
bool done;
};
The problem is that only at run-time the program knows how long my
'num' and 'mean' will be. So what I want to do is make a structure,
where I can incorporate the length into the structure and use that
length as an argument.
struct meta_segment
{
long double id;
long double num[NbElements];
long double mean[NbElements];
bool done;
};
I something like this possible? Or should I look for other solutions to
solve this problem?
Thank you very much in advance,
Stef
I am working with a structure:
struct meta_segment
{
long double id;
long double num;
long double mean;
bool done;
};
but I want to store multiple elements for some of the elements of my
structure. I was thinking of using arrays in my structure. E.g., when I
have 5 elements for 'num' and 'mean':
struct meta_segment
{
long double id;
long double num[5];
long double mean[5];
bool done;
};
The problem is that only at run-time the program knows how long my
'num' and 'mean' will be. So what I want to do is make a structure,
where I can incorporate the length into the structure and use that
length as an argument.
struct meta_segment
{
long double id;
long double num[NbElements];
long double mean[NbElements];
bool done;
};
I something like this possible? Or should I look for other solutions to
solve this problem?
Thank you very much in advance,
Stef