I know recursion is not the best way to do what i described in the title, but it's an exercise. I was wondering if there's any way of finding the maximum in an array recursively (in C) with the following conditions:
- No static variables allowed;
- If the first element is passed as a parameter, it would be cool to do so without the writer of the main block actually doing it (e.g. the writer passes the array and the dimension of the array, but the function uses
array[dim-1]
as the first maximum)
Thanks for the answers!