program to print reverse of an array in c++ code example
Example: c++ reverse array
int arr[5] = {1, 2, 3, 4, 5}; //Initialize array
for(int i = 0; i < size(arr); i++) {
//Create temporary variable to hold current value in array
int temp = arr[i];
//Set the current value in the array to the mirrored value in array
arr[i] = arr[size(arr) - 1 - i];
//Set mirrored value in array to temp, swapping the two numbers
arr[size(arr) - 1 - i] = temp;
}