So I have a matrix which was created this way :
 int **mat(int nl, int nc) {
  int i;
  int **v = malloc(nl * sizeof(int *));
  for (i = 0; i < nl; i++) {
    v[i] = calloc(nc, sizeof(int));
  }
  return v;
}
Let's say after the input , it is :
0 1 2 3 4 5
1 2 3 4 5 6
2 3 4 5 6 7
I would want to keep only the first 2 rows and first 3 columns , and free the memory of the other rows and columns , so it would look like :
0 1 2
1 2 3
How do I do that ?