So I've this:

```
int main()
{
    int workers;
    printf("How many workers are there?\n");
    scanf("%d", &workers);
    printf("What are their preferences?\n");
    int *pref = malloc(workers * sizeof(int));
    if (pref == NULL)
        return -1;

    fillPreferences(pref, workers);

  return 0;
}

```

I want now to fill the "pref" 2d array in this function:

```
void fillPreferences(int pref[][], int size)
{
    for (int i=0;i<size;i++)
    {
        for (int j=0;j<size;j++)
        {
            scanf(" %d", &pref[i][j]);
        }
    }
}

```

It doesn't work, probably because I'm using the pointer wrong. How can I use malloc and then call a function and receive the values in the 2d array by doing pref[i][j]? (Note that I'm not looking to do something like scanf(..., &pref+i) or whatever. I need to actually use that 2d array.

Thanks :)