why is there a segmentation fault?
#include <stdlib.h>
#include <stdio.h>

int fib(int **sequence, int n){
    int i; //index
    int j = 0; // term n-1
    int k = 1; // term n
    *sequence = malloc(n * sizeof(int));
    for (i = 0; i < n; i++){
        *sequence[i] = k;
        k += j;
        j = k - j;
    }
    return 0;
}

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;
}
