I have four arrays that contains some values. Another array should contain all these four arrays like shown in the code:
static const long ONE_COLOR[2] = { RGB_BLACK, RGB_WHITE };
static const long TWO_COLOR[4] = { RGB_WHITE, RGB_RED, RGB_GREEN, RGB_BLUE };
static const long THREE_COLOR[8] = { RGB_BLACK, RGB_RED, RGB_GREEN, RGB_BLUE,
RGB_CYAN, RGB_YELLOW, RGB_MAGENTA, RGB_WHITE };
static const long FOUR_COLOR[16] = { RGB_WHITE, RGB_RED, RGB_GREEN, RGB_BLUE,
RGB_CYAN, RGB_YELLOW, RGB_MAGENTA, RGB_DARK_RED, RGB_DARK_GREEN,
RGB_DARK_BLUE, RGB_LIGHT_BLUE, RGB_LIGHT_GREEN, RGB_ORANGE, RGB_LIME,
RGB_PINK, RGB_LILA };
//this array should contain all other arrays
static const long COLOR_ARRAY = {ONE_COLOR,TWO_COLOR, THREE_COLOR,
FOUR_COLOR };
My problem is to access the values in the array. I thought I can receive the value of RGB_BLACK
with COLOR_ARRAY[0][0]
. I tried it with some pointer constructions, but it doesn't work neither :(
COLOR_ARRAY
declared as an array? You call it "array" in the comments. You usedARRAY
in the variable name. But it is declared as an ordinary non-array variable. Why? You do know that array declaration requires[]
, don't you? So, where's[]
inCOLOR_ARRAY
declaration?