分配一个矩阵内存,有如下一个程序,但不知道是否正确? 
希望大侠能指点一二.告诉这个内存是如何分配的,十分感谢 
  
double   **matrix(long nrl, long nrh, long ncl, long nch) 
/* allocate a double matrix with subscript range m[nrl..nrh][ncl..nch] */ 

 long i, nrow=nrh-nrl+1,ncol=nch-ncl+1; 
 double **m; 
 /* allocate pointers to rows */ 
 m=(double **)malloc((size_t)((nrow+NR_END) 
  *sizeof(double *))); 
 if (!m) ::MessageBox(NULL,"allocation failure 1 in matrix()","kalman 工程", 
MB_OK); 
 m += NR_END; 
 m -= nrl; 
 /* allocate rows and set pointers to them */ 
 m[nrl]=(double *)malloc((size_t)((nrow*ncol+NR_END) 
  *sizeof(double)));  if (!m[nrl]) ::MessageBox(NULL,"allocation failure 2 in matrix()","kalman 工 
程",MB_OK); 
 m[nrl] += NR_END; 
 m[nrl] -= ncl; 
 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 
 /* return pointer to array of pointers to rows */ 
 return m; 

  
返回的m是指向首地址的指针吗? 
 m[nrl]=(double *)malloc((size_t)((nrow*ncol+NR_END) 
  *sizeof(double))); 
这句好像不应该分配这么大吧? 
谢谢!!!!!!