Here is a full example that shows you all thing things you have been asking over the past few days:
int colors[][3] = {
{255, 0, 0},
{0, 255, 0},
{0, 0, 255}
};
#define NCOLOR (sizeof(colors) / sizeof(colors[0]))
int *EXCLUSIVE_COLOR = NULL;
void setup() {
Serial.begin(115200);
Serial.print("You have ");
Serial.print(NCOLOR);
Serial.println(" colors defined.");
reportColor();
EXCLUSIVE_COLOR = colors[2];
reportColor();
EXCLUSIVE_COLOR = NULL;
reportColor();
}
void loop() {
}
void reportColor() {
if (!EXCLUSIVE_COLOR) {
Serial.println("Color is not set");
} else {
Serial.print("Color is set to ");
Serial.print(EXCLUSIVE_COLOR[0]);
Serial.print(",");
Serial.print(EXCLUSIVE_COLOR[1]);
Serial.print(",");
Serial.println(EXCLUSIVE_COLOR[2]);
}
}
You have an array of colours. You have a pointer that can point at a colour or at nothing. It starts off pointing at nothing. The code recognises that it's pointing at nothing and reports it. It gets assigned to a specific colour in your colours array. The code recognises that it's now a valid value and reports it. The pointer then gets pointed to nothing again. Again the code recognises that and tells you.
The result:
You have 3 colors defined.
Color is not set
Color is set to 0,0,255
Color is not set