user66820: I have two arrays. The first array is a multidimensional array holding color values. 
The 2nd array stores an active color from the 1st array. 
How can I assign an element from the multidimensional colors array to the 2nd EXCLUSIVE_COLOR array?
int colors[][3] = {
  { 255, 0, 0 },   
  { 0, 255, 0 },   
  { 0, 0, 255 },   
  { 253, 7, 210 }  
};
int EXCLUSIVE_COLOR[3] = {0};

I tried the following but neither seemed to work:
    EXCLUSIVE_COLOR = { 
      colors[0][0], 
      colors[0][1], 
      colors[0][2]
    };
    // error: assigning to an array from an initializer list

    EXCLUSIVE_COLOR = colors[0];
    // error: invalid array assignment


user7508: You can copy the array:
EXCLUSIVE_COLOR[0] = colors[0][0];
EXCLUSIVE_COLOR[1] = colors[0][1];
EXCLUSIVE_COLOR[2] = colors[0][2];

but this doesn't work in an initialization.
Alternatively, you can declare EXCLUSIVE_COLOR as a pointer to an
array of 3 integers:
int (*EXCLUSIVE_COLOR)[3]; // pointer to array 3 of int

Then you can have this point to a row of the 2D array, either by
assigning the pointer or in the initialization:
int (*EXCLUSIVE_COLOR)[3] = &colors[0];  // initialization

// Later in the program:
EXCLUSIVE_COLOR = &colors[1];

Note that when using this pointer, you will have to explicitly
dereference it:
for (int i = 0; i < 3; i++)
    Serial.println((*EXCLUSIVE_COLOR)[i]);

Edit: As pointed out by Juraj in a comment, you can instead make
EXCLUSIVE_COLOR a pointer to int. In this case you will make it point
to the first element in the row you want:
int* EXCLUSIVE_COLOR = &colors[0][0];

One nice thing of this approach is that you can use the “decay to
pointer” feature of the language to simplify the syntax:
int* EXCLUSIVE_COLOR = colors[0];

// Later
Serial.println(EXCLUSIVE_COLOR[i]);


66820: <p>I have two arrays. The first array is a multidimensional array holding color values. </p>

<p>The 2nd array stores an <strong>active</strong> color from the 1st array. 
How can I assign an element from the multidimensional <strong>colors</strong> array to the 2nd <strong>EXCLUSIVE_COLOR</strong> array?</p>

<pre><code>int colors[][3] = {
  { 255, 0, 0 },   
  { 0, 255, 0 },   
  { 0, 0, 255 },   
  { 253, 7, 210 }  
};
int EXCLUSIVE_COLOR[3] = {0};
</code></pre>

<p>I tried the following but neither seemed to work:</p>

<pre><code>    EXCLUSIVE_COLOR = { 
      colors[0][0], 
      colors[0][1], 
      colors[0][2]
    };
    // error: assigning to an array from an initializer list

    EXCLUSIVE_COLOR = colors[0];
    // error: invalid array assignment
</code></pre>
 7508: <p>You can copy the array:</p>

<pre class="lang-cpp prettyprint-override"><code>EXCLUSIVE_COLOR[0] = colors[0][0];
EXCLUSIVE_COLOR[1] = colors[0][1];
EXCLUSIVE_COLOR[2] = colors[0][2];
</code></pre>

<p>but this doesn't work in an initialization.</p>

<p>Alternatively, you can declare <code>EXCLUSIVE_COLOR</code> as a pointer to an
array of 3 integers:</p>

<pre class="lang-cpp prettyprint-override"><code>int (*EXCLUSIVE_COLOR)[3]; // pointer to array 3 of int
</code></pre>

<p>Then you can have this point to a row of the 2D array, either by
assigning the pointer or in the initialization:</p>

<pre class="lang-cpp prettyprint-override"><code>int (*EXCLUSIVE_COLOR)[3] = &amp;colors[0];  // initialization

// Later in the program:
EXCLUSIVE_COLOR = &amp;colors[1];
</code></pre>

<p>Note that when using this pointer, you will have to explicitly
dereference it:</p>

<pre class="lang-cpp prettyprint-override"><code>for (int i = 0; i &lt; 3; i++)
    Serial.println((*EXCLUSIVE_COLOR)[i]);
</code></pre>

<p><strong>Edit</strong>: As pointed out by Juraj in a comment, you can instead make
<code>EXCLUSIVE_COLOR</code> a pointer to int. In this case you will make it point
to the first element in the row you want:</p>

<pre class="lang-cpp prettyprint-override"><code>int* EXCLUSIVE_COLOR = &amp;colors[0][0];
</code></pre>

<p>One nice thing of this approach is that you can use the “decay to
pointer” feature of the language to simplify the syntax:</p>

<pre class="lang-cpp prettyprint-override"><code>int* EXCLUSIVE_COLOR = colors[0];

// Later
Serial.println(EXCLUSIVE_COLOR[i]);
</code></pre>
