My compiler doesn't let me to allocate in this way--> Matrix[numberrows][numbercolumns], so my question is, how can I allocate memory for a matrix using calloc?? If it is impossible, can anyone tell me what to do?
If you want to access your matrix using the element access operator [], then you need to allocate the
matrix in the following way:
1 2 3 4 5
double** pMatrix = newdouble*[ Nyfm ];
for( size_t i = 0; i < Nyfm; ++i ) {
pMatrix[ i ] = newdouble[ Nxfm ];
// You'll want to zero out pMatrix[ i ][ 0 ] ... pMatrix[ i ][ Nxfm - 1 ] here
}
(You should use new instead of calloc if writing C++ code, though either one would work).