How to free 2d array in C? December 21, 2023 by Tarik Just the opposite of allocation: for(int i = 0; i < N; i++) free(ptr[i]); free(ptr);