Memory at runtime <p>I have a problem which says I have to read an unknown number of text lines from a file in an array of pointers and allocate memory at runtime.</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; int main() { FILE *fp = fopen("file.txt","r"); char *arrp[10]; int i=1; while(!feof(fp)) { arrp[i]=malloc(sizeof(char)*51); fgets(arrp[i],51,fp); i++; } return 0; } </code></pre> <p>I wrote this program but I don't know how to do it without initializing the array first (*arrp[10]).</p>