+ 1
What is the output of c program if we will not give the terminating condition in recursion.
2 Antworten
+ 4
This is an run time error.
If there is no stoping condition it calls it again and again nd calling of a functions add address to the stack where it leave the function.
Stack has finite size of memory so a point came when its full and cause stack overflow at run time and terminate abruptly,
You Can Try
#include <stdio.h>
int i=0;
int func(){
i+=1;
func();
}
int main()
{
func();
return 0;
}
this code
+ 4
If a recursion never reaches a base case(terminating condition), it will go on making recursive calls forever and the program will never terminate. This is known as infinite recursion, and it is generally not considered a good idea. In most programming environments, a program with an infinite recursion will not really run forever.
You will just get a stack overflow.