how should is properly use this array of struct

I'm sorry if, for my bad English, i was trying a program who use a calc_vet_struct for try find the first number bigger than the previous one, my code for the struct and define it is :

constexpr int n = 50;
struct dati
    float val;
    int rig1;
    int col1;
typedef dati VS[n];

and i declered

VS calc_vett_struct(mat, int, int);

as my subprogram then in my main called it doing :

S = calc_vett_struct(m, rig, col);

and created it in this way:

    VS calc_vett_struct(mat m, int rig, int col)
    VS p;
    for (int i = 0; i < rig; i++)
        bool found = false;
        for (int j = 0; j < col - 1; j++)
            if (m[i][j] > m[i][j + 1] && found = true)
                p[i].val = m[i][j];
                p[i].rig1 = i;
                p[i].col1 = j;
                found = true;
    return p;

hope is enough understandble and hope you can help me, if something is not clear please ask it.

the error is : function cannot return a matrix