What I'm Trying To Do
Basically, I've got several possible arrays that I define with macros:
#define ARRAY_ONE {0, 2, 7, 8}
#define ARRAY_TWO {3, 6, 9, 2}
#define ARRAY_THREE {3, 6, 4, 5}
//etc...
At runtime, I have a C-Array that gets used in a lot of places in a certain class. I want this array to use one of the #define values, i.e:
int components[4];
if (caseOne)
{
components = ARRAY_ONE;
}
else if (caseTwo)
{
components = ARRAY_TWO;
}
else if (caseThree)
{
//etc...
}
-
The Problem
However, the above code does not work. Instead, I get a weird error
Expected expression before '[' token
Would anyone mind explaining what's going on, and how I could achieve what I'm attempting to? Any help would be much appreciated - Thanks!