title: initializing an array using a function in C
body: <p>I am doing an assignment for class and I thought I would bug you all with a question:</p>
  
  <p>So the purpose of the program is for the user to enter the size of the array and then initialize it with some data. Max size is 20. My issue is that the array crashes when the sets the size beyond 14 and tries to initialize it. So forexample, if it sets the size as 20, it accepts it, but when I try to initialize it, it crashes. I have no idea what I am doing. your help is much appreciated. </p>
  
  <p>Thank you very much,</p>
  
  <p>Essi</p>
  
  <pre><code>int main ()
  {
  
       int sizeOfArray = 0; //size Of Array
       float myArray[sizeOfArray];
  
       //I have a piece a line or two of code that asks the user for the size of the    
         array
  
       printf("Let's Initialize an array of size %d!!\n", sizeOfArray);
       do
       {
             printf("Enter array element %d : ", initCounter+1);
             myArray[initCounter] = userInitArray();
             initCounter++;
        }while (initCounter &lt; sizeOfArray);
  }
  
  float userInitArray()
  {
        float num;
        scanf("%f", &amp;num);
        return num;
  }
  </code></pre>