Finding Maximum Element in an Array using Recursion
Recursion is something that may be a little confusing to understand but when you master it would be very much easier and will actually consume less space compared to a normal iterative function. So now we will write a program to find the maximum element in an array using recursion.
- Get the numbers from the user and pass the array and size of array to the function
- Declare max as global and initialise it to a.
- Inside the function check for the condition of maximum element and if the index value reaches -1 return the maximum element.