the code results in a segmentation fault, why did it take place?
void fib(int **sequence, int num_elements) {
    *sequence = malloc(sizeof(int) * num_elements);
    *sequence[0] = 0;
    if (num_elements >= 1) {
        *sequence[1] = 1;
        for (int i = 2; i < num_elements; i++) {
            *sequence[i] = *sequence[i - 2] + *sequence[i - 1];
        }
    }
    }

int main(int argc, char **argv) {
    /* do not change this main function */
    int count = strtol(argv[1], NULL, 10);
    int *fib_sequence;

    fib(&fib_sequence, count);
    for (int i = 0; i < count; i++) {
        printf("%d ", fib_sequence[i]);
    }
    free(fib_sequence);
    return 0;
}