I actually have an embarrassingly simple problem that I can't seem to overcome, currently. I'm trying to create a struct and then assign values to it in a separate function. Unfortunately, every solution I've tried doesn't seem to work and I have a feeling, I'm missing something really basic . . .
Here is the database struct (I've removed a few elements that aren't necessary here, so please ignore the simplicity. We actually read from a database but I'm creating a basic application for test purposes that is going to simulate a database that I'll be reading from to test a function):
struct Database
{
double Output[12];
};
Database tempdatabase;
I have tried the following:
void InitVars()
{
tempdatabase.Output[12] = {-1.938,29.063,0,0,0,0,0,0,0,0,0,0};
}
and
void InitVars()
{
double temparray1[12] = {-1.938,29.063,0,0,0,0,0,0,0,0,0,0};
tempdatabase.Output[12] = temparray1[12];
}
and
void InitVars()
{
tempdatabase.Output[12] = new[]{-1.938,29.063,0,0,0,0,0,0,0,0,0,0};
}
I'm sure the answer to this is really, really simple but I haven't been able to have any success getting around this. Can anyone help me get this sorted out? Any help would be greatly appreciated. Thanks!