I want to do a program by using recursion. I am going to use if-else. The question is: Do I have to return something in each case of if-else?
2 Answers
Yes, there is a stack trace for each transfer of pointer to a new location. And in order to implement recursion, you need to return something in each case of if-else, or at least after each if-else you need to perform some operation and store the result in a memory location which is global and accessible anywhere from your code.