what errors are in my code? how to fix?

int **split_array(const int *s, int length) {
  int n;
  int counter = 0;
  int counter1 = 0;
  if (length % 2 == 0) n = length / 2;
  else n = length / 2 + 1;
  int **nums = (int **)malloc(2 * sizeof(int *));
  int *nums = (int *)malloc(n * sizeof(int));
  int *(nums + 1) = (int *)malloc((length / 2) * sizeof(int));
  for (int i = 0; i < length; i++) {
    if (i % 2 == 0) {
      *(*(nums + counter)) = *(s + i);
      counter++;
    }
    else {
      *(*(nums + counter1) + 1) = *(s + i);
      counter1++;
    }
  }
  return nums;
  /*
  for (int i = 0; i < n; i) {
    *(even + i) = *(s + i);
  }
  for (int j = 0; j < (n / 2); j++) {
    *(odd + j) = *()
  }*/
}