0

I have to take the following code and make it tail recursive.

I am not looking for the answer, but how to find the answer. How to work through this to understand what I need to do. Our hint is that we can change the parmeters of the function, like changing the number/type of the functions arguments.

// this program returns the maximum value in an array

int max(int numbers[ ], int size) {

if (size == 1)

return *numbers;

int first = *numbers;

int rec_max = max(numbers+1, size-1);

if (first > rec_max) return first;

return rec_max;

}