很久没写C语言的代码,发现很多小细节。
#include <stdlib.h> #include <stdio.h>
double ** a; //a[m][n] a = (double **) malloc (sizeof(double *) *m); for (int i = 0; i < m; i ++) a[i] = (double *) malloc (sizeof(double) *n);
for (int i = 0; i < m; i ++){ free(a[i]); } free(a);