double **new_dmatrix(int M, int N);
void free_dmatrix(double **top);

int main() {
double **Array1, **Array2;
Array1 = new_dmatrix(100,100);
Array2 = new_dmatrix(100,100);
......
free_dmatrix(Array1);
free_dmatrix(Array2);
}

double **new_dmatrix(int M, int N){
double **top;
int i,j;
top = (double **)malloc(sizeof(double *) * M);
top[0] = (double *)malloc(sizeof(double) *M*N);
for(i=1; i<M; i++) top[i] = top[i-1]+M;
for(i=0;i<M;i++){
for(j=0;j<N;j++){
top[i][j] = 0.0;
}
}
return top;
}

void free_dmatrix(double **top){
free(top[0]);
free(top);
}