#Pointer in recursion

4 messages · Page 1 of 1 (latest)

dreamy rockBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.

pale moat
#

and here is the working code:

double * last_year = rabbits_by_age(year - 1);
    static double previous_year[5];
    previous_year[0] = *last_year;
    previous_year[1] = *(last_year + 1);
    previous_year[2] = *(last_year + 2);
    previous_year[3] = *(last_year + 3);
    previous_year[4] = *(last_year + 4);
    this_year[1] = previous_year[0];
    this_year[2] = previous_year[1];
    this_year[3] = previous_year[2];
    this_year[4] = previous_year[3];
    this_year[0] = this_year[3] + this_year[4];
    return this_year;```
dreamy rockBOT
#

@pale moat

Please Do Not Delete Posts!

Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. You can use !solved to close a post and mark it as solved.

pale moat
#

!solved