user60866: I've got two arrays, defined as:
uint8_t array1[10];
uint8_t array2[10];

I'd like to swap the arrays (actually the pointers to each array) using code like this:
uint8_t *tmp = array1;
array1 = array2;
array2 = tmp;

However, I keep getting errors like:
invalid array assignment

for the last two lines. I don't recall this being such a problem in traditional C++. I've tried all sorts of casting to no avail. Is there something I'm missing?
I can get the code to run properly if I switch the declarations for the arrays to use new and have them just be more-or-less pointers rather than arrays, but I'd rather not have to do that:
uint8_t *array1 = new uint8_t[10];
uint8_t *array2 = new uint8_t[10];

Code is running on an ARM-based SAMD51 (Cortex M4 processor).
Thanks for any tips!

user60866: Figured it out. Though using new works, I wanted to keep the buffers out of the heap. The following declarations work with the swap code:
uint8_t a1[10];
uint8_t a2[10];
uint8_t *array1 = a1;
uint8_t *array2 = a2;

uint8_t *tmp = array1;
array1 = array2;
array2 = tmp;


60866: <p>I've got two arrays, defined as:</p>

<pre><code>uint8_t array1[10];
uint8_t array2[10];
</code></pre>

<p>I'd like to swap the arrays (actually the pointers to each array) using code like this:</p>

<pre><code>uint8_t *tmp = array1;
array1 = array2;
array2 = tmp;
</code></pre>

<p>However, I keep getting errors like:</p>

<pre><code>invalid array assignment
</code></pre>

<p>for the last two lines. I don't recall this being such a problem in traditional C++. I've tried all sorts of casting to no avail. Is there something I'm missing?</p>

<p>I can get the code to run properly if I switch the declarations for the arrays to use <code>new</code> and have them just be more-or-less pointers rather than arrays, but I'd rather not have to do that:</p>

<pre><code>uint8_t *array1 = new uint8_t[10];
uint8_t *array2 = new uint8_t[10];
</code></pre>

<p>Code is running on an ARM-based SAMD51 (Cortex M4 processor).</p>

<p>Thanks for any tips!</p>
 60866: <p>Figured it out. Though using <code>new</code> works, I wanted to keep the buffers out of the heap. The following declarations work with the swap code:</p>

<pre><code>uint8_t a1[10];
uint8_t a2[10];
uint8_t *array1 = a1;
uint8_t *array2 = a2;

uint8_t *tmp = array1;
array1 = array2;
array2 = tmp;
</code></pre>
