Why infinite recursion leads to seg fault ? Why stack overflow leads to seg fault. I am looking for detailed explanation.
int f()
{
f();
}
int main()
{
Segmentation fault is a condition when your program tries to access a memory location that it is not allowed to access. Infinite recursion causes your stack to grow. And grow. And grow. Eventually it will grow to a point when it will spill into an area of memory that your program is forbidden to access by the operating system. That's when you get the segmentation fault.