I have created a very simple program that uses recursion. I'm using the g++ compiler. I can compile it, but when I try to run it I get an error message that says SEGMENTATION FAULT. Here's my code:
#include <iostream.h>
using namespace std;
int Recurse(int);
int main(int argc, char *argv[])
{
Recurse(10);
cout << endl;
}
int Recurse(int numTimes)
{
if (numTimes == 0)
return 0;
else
{
cout << numTimes << " ";
Recurse(numTimes--);
}
}