u/a4qbfbin r/C_Programming • Recommends
On “Help me guys please!”
> I still "see" the recursive function in line 23 just like a division by 2. Which obviously is not.
Think of it as: “when I get to this point, I make a note of what I was doing, then evaluate `toBinary()` with half the original number as argument; once that is done, I insert that into my arithmetic expression and continue.”
> I also don't get why in your example you basically never enter the base case of the function that should terminate it.
Because we had already examined that case, so I just reused the previous result instead of going through it again.
I have an idea. Take that code and type it in, if you haven't already. Then replace the last line of `toBinary()` with the following:…