#include <iostream>
using namespace std;
int* reverse(int* list, int size)
{
for (int i = 0, j = size - 1; i < size; i++, j--)
{
// Swap list[i] with list[j]
int temp = list[j];
list[j] = list[i];
list[i] = temp;
}
return list;
}
void printArray(const int* list, int size)
{
for (int i = 0; i < size; i++)
cout << list[i] << " ";
}
int main(){
int list[6] = { 1,2,3,4,5,6 };
int *ptr = reverse(list, 6);
printArray(list,6);
}