What is mean by base case | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is mean by base case

Recurrion

10th Nov 2019, 6:53 PM
Sakshi Pachkhande
Sakshi Pachkhande - avatar
1 Answer
+ 7
If you use method recursion and you dont write base case than stackoverflow exception was happen. Here is example In that code stackoverflow exception was happen void fun(){ fun(); } And in this code stackoverflow exception will not happen void fun(){ if ( any condition ) // base case fun(); }
10th Nov 2019, 7:05 PM
Sumit Programmer😎😎
Sumit Programmer😎😎 - avatar