c++ using "indexing" over a 2D matrix, under this structure
<p>don't know why but i get an error: after this structure i can't index the matrix, so i cant use the "indexing method" over the defined matrix.Can anyone tell me why? or how to fix it?</p>

<pre><code>Header:
const int days=31;
const int exp=6;

struct Array{
int days;
int exp;
int **M;
};
</code></pre>

<p>Constuctor:</p>

<pre><code>void constr(Array loc){
//Construct of 31*6 Matrix, were 31 nr. of days and 6 specific types:
//0-HouseKeeping, 1-Food, 2-Transport, 3-Clothing, 4-TelNet, 5-others
loc.days = days;
loc.exp = exp;
loc.M = new int*[loc.days];
for(int i=0; i&lt;loc.days;i++ ){
   loc.M[i] = new int[loc.exp];
   for (int j = 0; j&lt; loc.exp; j++){
       loc.M[i][j] = 0;
   }
}
}
</code></pre>

<p>Controller.cpp</p>

<pre><code> void add(int cant,int tip, Array M){
//Adds to current day the amount to a specific type
currDay();
M[currentDay][tip] += cant; ////////////error
}


void insert(int zi,int tip,int cant, Array M){
//Adds to current day the amount to a specific type
M[zi][tip] = cant; ///////////error
}

void removeDay(int day, Array M){
for(int i = 0; i&lt;6; i++)
    M[day][i] = 0; ///////////error

//zi and tip ~ day type... for easier read.
//i need to manage the expenses of a family in a month  doesn't matter which
ERROR: error: no match for 'operator[]'

UI(where constructor is used):

int main(){
Array M;
constr(M);
printMenu();
return 0;
}
</code></pre>
