For some reason I get the error "No matching function call to 'OptimalBinarySearchTree'" on line 15. I am not sure if it has something to do with the way I am passing the array pointers or if I have left something off. I've never tried passing a 2D array before, so it may be messing it up.
#include <iostream>
using namespace std;
void OptimalBinarySearchTree(int n, int *P[n], int (*values)[n][n], int (*roots)[n][n]);    
int main()
{
    const int n = 18;
    char A[n] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R'};
    int P[n] = {995,22,23,562,33,8,60,118,30,723,807,626,15,89,21,128,626,621};
    int values[n][n];
    int roots[n][n];
    OptimalBinarySearchTree(n, P, values, roots);
    return 0;
}
void OptimalBinarySearchTree(int n, int *P[n], int (*values)[n][n], int (*roots)[n][n])
{
    for (int i = 1; i <= (n+1); i++)
    {
        (*values)[i][i] = 0;
    }
    for (int i = 1; i <= n; i++)
    {
        (*values)[i][i] = *P[i];
        (*roots)[i][i] = i;
    }
    for (int d = 1; d <= (n-1); d++)
    {
        for (int i = 1; i <= (n-d); i++)
        {
            int j = i + d;
            int sumP = 0;
            int minValue = 999999999;
            int minRoot = 0;
            for (int k = i; k <= j; k++)
            {
                sumP += *P[k];
                int value = (*values)[i][k-1] + (*values)[k+1][j];
                if (value < minValue)
                {
                    minValue = value;
                    minRoot = k;
                }
            }
            (*values)[i][j] = sumP + minValue;
            (*roots)[i][j] = minRoot;
        }
    }
};
Any help would be appreciated. Thanks,
 
    