This is how I allocate space for a matrix
Code:
//Initialize matrix
*matrix= (float**) malloc(Rows * sizeof(float *));
for (i=0;i<Rows;i++){
(*matrix)[i]=(float *) malloc(MCols * sizeof(float));
for (j=0 ;j<MCols;j++){
(*matrix)[i][j]=0.0;
}
}
how can I deallocate the same matrix?
I used this code:
Code:
void deallocateMatrix(float ***matrix, int numRows){
int i;
for(i=0;i<numRows;i++){
free((*matrix)[i]);
}
free(*matrix);
}
(is it correct??)
but it doesn't works. And nothing again with **matrix in input.