Sample program for how to use exit(0) function in C:
What is the output of below C program.
int i = 10;
printf("%d\n", i ) ;
infinite loop and crash due to stack over flow.
infinite loop and crash due to stack over flow. Since this is recursive function call, there is no proper condition to break this. even though we are stopping recursion when i crosses 10, where i will never cross 10 because i is a local variable which will be created afresh every time main is called. So it is a infinite loop of recursion and crashes.
Back To Top