title: User to read in numbers for an array of undefined size
body: <p>I have this program:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  int main()
  {
      int i;
      int myArray[5];
  
      printf("Enter some numbers for the array.\n\n");
  
      for( i = 0; i &lt; 5; i++ )
      {
      scanf("%d", &amp;myArray[i]);
      }
  
      printf("\nPrinting array...\n\n");
  
      for( i = 0; i &lt; 5; i++)
      {
      printf("%d \n\n", myArray[i] );
      }
  
  }
  </code></pre>
  
  <p>I want to modify my program to allow the user to enter as many numbers as they like and when they are done they can type "-1" which would then exit the scanf loop and move on in the program to print the array. The problem is that I don't understand how I can declare an array without a size. I know I can use <code>sizeof(myArray / myArray[0]);</code> to find the number of elements in the array but the compiler wants me to always enter some initial size which I don't know.</p>