I am trying to dynamically allocate an array passed through a parameter in the function dynamic_allocation_array and I don't understand why isn't it working. 
#include <stdio.h>
#include <stdlib.h>
void dynamic_allocation_array(int **a, int n){
    (*a) = (int *)malloc(n * sizeof(int *));
    for(int i = 0; i < n; i++){
        scanf("%d", *(a + i));
    }
}
int main()
{
    int n, *a;
    scanf("%d", &n);
    dynamic_allocation_array(&a, n);
    for(int i = 0; i < n; i++){
        printf("%d ", a[i]);
    }
    return 0;
}





void malloc(void **, size_t);