Problem Statement:
I am trying to wrap my head around recursion, and I'm slowly getting a handle on it, but I keep running into brick walls with it. My current issue is with an assignment to write a recursive function to empty a linked list. A wrapper function is employed to call the recursive function. The recursive function takes as argument a single pointer to a node, and returns a bool value. This last part is where I keep stumbling. I can write the function as a void, but when the function call is required to return something that isn't part of what the function is supposed to accomplish, I don't understand how to structure it.
This is the most recent version of this function. I've tried rearranging this a bunch of different ways, and if it were permitted to write it as a void function, this wouldn't be a problem. Any hint as to what I'm missing as far as designing this would be greatly appreciated!
Do I understand correctly from your example that a bool function can be called in the same fashion as a void function? That is, I don't need an assignment such as bool whatever = funcCall(), or to use the function call in an expression?
from your example that a bool function can be called in the same fashion as a void
This is not specific to bool. Which the above links should explain along the way, but just to be sure you got it since this part of your question would not be stated explicitly. Any type can be thrown away.