[Solved] Why does int main() { return main(); } cause stackoverflow and not tail recursion?
The code you have shown will call main infinitely, and therefore will result a stack overflow. This is true in the case of any function and not specific to main. Each function call a stack frame is created in memory, and as infinite such frames is created as the recursion goes deep, you get a … Read more