Gollex:
Hey, I have three dimensional array. I need to find the amount of rows in it (example below). How can I do it?
Example array, trying to find value x.
int array[X][2][3] = {
{{1, 2, 3}, {2, 2, 2}},
{{2, 3, 2}, {3, 5, 2}},
... (n lines)
{{1, 1, 1}, {3, 2, 2}}
};
I cannot change the structure of the array as it is blueprint for controlling RGB LEDs row by row.
The size of your three dimensional array can be determined this way:
int array[][2][3] = {
{{1, 2, 3}, {2, 2, 2}},
{{2, 3, 2}, {3, 5, 2}},
{{2, 3, 2}, {3, 5, 2}},
{{1, 1, 1}, {3, 2, 2}}
};
void setup()
{
Serial.begin(9600);
Serial.println(sizeof(array)/sizeof(array[0]));
Serial.println(sizeof(array)/sizeof(array[0][0]));
Serial.println(sizeof(array)/sizeof(array[0][0][0]));
}
void loop()
{
}