What are the declarations in this?
They were left out for brevity.
n=size of the array. If you have the array:
Code:
int myArray[] = {10, 20, 30};
the size of the array is 3 but the valid index numbers are:
myArray[0] = 10
myArray[1] = 20
myArray[2] = 30
An array name is like a pointer to the first element. So, you can set a pointer to the first element like this:
Code:
int* p = myArray;
cout<<*p<<endl; //10
Or, you can set the pointer to point to other elements of the array:
Code:
p = &myArray[2]; //"p is equal to the address of myArray[2]"
cout<<*p<<endl; //30
Pointer arithmetic allows you to move the pointer along the array with the increment operator(++) or the decrement operator(--). Since you want to output the elements in reverse order, setting a pointer to the end of the array, and then decrementing that pointer everytime through a for-loop to move it along the array seems like a good approach.