Call a function that receives an array using a pointer
<p>So I've this:</p>

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

    fillPreferences(pref, workers);

  return 0;
}
</code></pre>

<p>
I want now to fill the "pref" 2d array in this function:</p>

<pre><code>void fillPreferences(int pref[][], int size)
{
    for (int i=0;i&lt;size;i++)
    {
        for (int j=0;j&lt;size;j++)
        {
            scanf(" %d", &amp;pref[i][j]);
        }
    }
}
</code></pre>

<p>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(..., &amp;pref+i) or whatever. I need to actually use that 2d array.
<br>
Thanks :)</p>