Hi all,
I'm new to this forum. I need help understanding this program. Why does it pop element from the back similar to stack? Any help is appreciated.
#include<iostream>
using namespace std;
int AmericanIdol(int *simon);
int main()
{
int RandyJackson[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 99 };
int *paula;
paula = RandyJackson;
AmericanIdol(paula);
return 0;
}
int AmericanIdol(int *simon)
{
if (*simon == 99) return 0;
AmericanIdol(simon + 1);
cout << *simon << endl;
return 0;
}
The function recurses before it prints.