Swap arrays by using pointers in C++
问题 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: 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