I understand the array address but this code which I found in a book made me nut.I understand the recursive function too but did not get this one.Here is the code:
int main(){
const int arraySize = 5;
int a[arraySize] = { 32, 27, 64, 18, 95};
cout << "The values in reverse array are:" << endl;
someFunction(a, arraySize);
cout << endl;
cin.get();
return 0;
}
void someFunction(int b[], int size)
{
if (size > 0) {
someFunction(&b[1], size - 1);
cout << b[0] << " ";
}
}
I got this code in a exercise.My question is how it is reversing the array?I will be happy if anyone explain a bit more.thanks
const, btw). Stepping in to that function with a debugger examining the address value atband the corresponding remaining size would be very telling. Drawing a call-hierarchy with parameter values would be equally so.