Segmentation fault after reading a data file into a 2D array
<p>I get a segmentation fault when I try to run my code to read a data file into a 2D array. Not sure if I'm not passing the array properly or I'm reading the file into the array properly.</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;

void two_D_input(FILE *fp, int **arr, int* r, int* c)
{
        size_t count;
        char *line = malloc(20);
        while(getline(&amp;line, &amp;count, fp) != 1) {
                for(; count &gt; 0; count--, *c++)
                        sscanf(line, "%d", *&amp;arr[*r][*c]);
                *r++;
        }
}

main()
{
        int a, b, i, j;
        int* array[10][10];
        FILE *f;
        f = fopen("test", "r");
        two_D_input(f, &amp;array[0][0], &amp;i , &amp;j);
        for(a =0; a &lt; i; a++){
                for(b=0;b&lt;j; b++){
                        printf("\n%d", array[a][b]);
                }
        }
        fclose(f);
}
</code></pre>

<p>The file test looks like this for now.</p>

<pre><code>1    0
1    1
</code></pre>