Correct use of free() when deallocating a 2d matrix in c
问题 I'm just starting to learn coding in c, and I have a few questions regarding 2d matrices in combination with the free() command. I know that you first need to create an array with pointer, pointing to the different columns of the matrix: double **array = (double **)malloc(5*sizeof(double *)); for(int n = 0; n<5; n++){ array[n] = (double *) malloc(6*sizeof(double)); I know that the correct way to then deallocate this matrix is to first deallocate the individual rows and then the array pointer