I'm writing a function that will find the number with max number of divisors but the function is not returning anything. Can someone point out my mistake?
This is the question
Write a C++ program that creates and integer array having 30 elements. Get input in this array (in main function). After that, pass that array to a function called “Find_Max_Divisors” using reference pointer. The function “Find_Max_Divisors” should find (and return) in the array that number which has highest number of divisors. In the end, the main function displays that number having highest number of divisors.
#include <iostream>
using namespace std;
int main ()
{
    int arr[30];
    int* array = &arr[30];
    cout << "Please enter values of the array" << endl;
    for (int i=0; i<30; i++)
    {
        cin >> arr[i];
    }
    cout << "Number with most divisors in array is " << endl;
    int Find_Max_Divisors (*array);
}
int Find_Max_Divisors (int p[])
{
    int count=0, max_divisor, max_counter, prev=0, repeat=0, divisor;
    for (int i=2; i<=30; i++)
        {
            if (p[i]%i==0)
            {
                count++;
            }
            if (count > prev)
            {
                prev = count;
                divisor = p[i];
            }
            if (count==max_counter && max_counter!=0)
            {
                cout << p[i] <<" has maximum of "<< count <<" divisors.\n";
            }
        max_counter = prev;
        max_divisor = divisor;
        repeat++;
        }
        return count;
}
 
     
     
     
     
    