how do I fix the code with behaviour described as: Return a pointer to an array of two dynamically allocated arrays of ints. The first array contains the elements of the input array s that are at even indices. The second array contains the elements of the input array s that are at odd indices. Do not allocate any more memory than necessary. You are not permitted to include math.h. You can do the math with modulo arithmetic and integer division.
int **split_array(const int *s, int length) {
    int **arr_indexes = malloc(2 * sizeof(int*));
    int even_count = 0;
    int odd_count = 0;
    for (int i = 0; i < length; i++) {
        if (s[i] % 2 == 0) {
            even_count += 1;
        } else {
            odd_count += 1;
        }
    }
    int *even_pt = malloc(even_count * sizeof(int));
    int *odd_pt = malloc(odd_count * sizeof(int));
    int even_idx = 0;
    int odd_idx = 0;
    for (int i = 0; i < length; i++) {
        if (s[i] % 2 == 0) {
            even_pt[even_idx] = s[i];
            even_idx += 1;
        } else {
            odd_pt[odd_idx] = s[i];
            odd_idx += 1;
        }
    }
    
    arr_indexes[0] = even_pt;
    arr_indexes[1] = odd_pt;
    return arr_indexes;
}