It is known that in some cases an iteration can be transformed in a recursive algorithm. How can I rewrite an iteration as simple as the following one as a recursion?
for(i=0,i<500,i++)
row_multiply();
I realize that, as it has been pointed out, I have to try something like...
void recursiveSolution(int i)
{
raw_multiply();
if (i< 499)
recursiveSolution(i+ 1);
}
..., but I am unsure about how to deal with the base case and how to structure coherent C code for the recursive rewrite.
base case?? explain that please.count == 500, there the recursion stops. A very illustrative recursive functions as that of the factorial calculation, google it. And if my answer was useful you can express gratitude by clicking the check mark and accepting it. After all, since the question is closed, no one else can post answers for it. Weired thing it was closed as unclear what you're asking and yet it was answered.