- 1
C++ arrays
I currently don't have any compiler around so im wondering if arrays can be assigned this way: char *array1 = new char[128]; char *array2 = new char[128]; char *temp; temp = array1; array1 = array2; array2 = temp; temp = 0; delete[] array1; delete[] array2; In the above it is intended to swap the addresses of array1 and array2 but can it be done this way?
1 Réponse
+ 1
You can try running this program yourself on SoloLearn.