Question: I tried to compile the following program 

```
void rec(int n)
{
    if(n>0)
   {
        rec(n-1)
        print ("n");

   }
}

```

Here `n` value is a big no. like `1000000`.

o/p is : `segmentation fault (core dumped)`

Can anyone explain what exactly happens here ?
Thanks.

Answer: 
For programs compiled with GCC with default settings stack size is about 2 megabytes. So you are limited in recursive calls by your stack size, because every not-tail recursion function call reduces free stack memory. Thats why you will get stack overflow when `n` is big number.
You missed a semicolon and i guess that you want to print the number n and not
n times the letter n. Here is your fixed code.

```
void rec(int n){
    if(n>0){
        rec(n-1);
        printf("%d\n",n);
    }
}

```

To get back to your problem. Recursive function have the problem that each call creates a new stack. You can imagine that with each call you go deeper and deeper and are only climbing back up at the very end.
The number of stacks is limited, so the program will eventually crash if you increase the number of recursive calls.