Why does this give segmentation fault?
#include <stdio.h>
#include <stdlib.h>

int **split_array(const int *s, int length) {
  int **pt=NULL;
  *pt = malloc(sizeof(int *) * 2);
  pt[0] = malloc(sizeof(int) * (length - (length / 2)) );
  pt[1] = malloc(sizeof(int) * (length / 2));
  int j=0;
  int k=0;
  for(int i=0;i<length;i++){
    if(i % 2 ==0) {
      pt[0][j] = s[i];
      j +=1;
    } else {
      pt[1][k] = s[i];
      k +=1;
    }
  }
  return pt;

}

int *build_array(char **strs, int size) {
  int arr[size];
  for(int i=0;i<size;i++){
    arr[i] = strtol(strs[i], NULL, 10);
  }
  int *pt = arr;
  return pt;
}


int main(int argc, char **argv) {
    int *full_array = build_array(argv,argc-1);
    int **result = split_array(full_array, argc-1);

    printf("Original array:\n");
    for (int i = 0; i < argc - 1; i++) {
        printf("%d ", full_array[i]);
    }
    printf("\n");

    printf("result[0]:\n");
    for (int i = 0; i < argc / 2; i++) {
        printf("%d ", result[0][i]);
    }
    printf("\n");

    printf("result[1]:\n");
    for (int i = 0; i < (argc - 1) / 2; i++) {
        printf("%d ", result[1][i]);
    }
    printf("\n");
    free(full_array);
    free(result[0]);
    free(result[1]);
    free(result);
    return 0;
}
