title: Swap arrays by using pointers in C++
body: <p>I have two arrays of pointers to doubles that I need to swap. Rather than just copy the data within the arrays, it would be more efficient just to swap the pointers to the arrays. I was always under the impression that array names were essentially just pointers, but the following code receives a compiler error:</p>
  
  <pre><code>double left[] = {1,2,3};
  double right[] = {9,8,7};
  
  double * swap = left;
  left = right; // Error "ISO C++ forbids assignment of arrays"
  right = swap; // Error "incompatible types in assignment of `double*' to `double[((unsigned int)((int)numParameters))]'"
  </code></pre>
  
  <p>Creating the arrays dynamically would solve the problem, but can't be done in my application. How do I make this work?</p>